• JAVED AHMED 1
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 9
    Replies
i want all contacts asscociate with an account on available option and in selected options i want those contacts which are primary
i want all contacts asscociate with an account on available option and in selected options i want those contacts which are primary
java script:

import { LightningElement, track, wire } from 'lwc';
import getDealers from '@salesforce/apex/OppTableContoller.getDealers';
import { NavigationMixin } from 'lightning/navigation';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import {refreshApex} from '@salesforce/apex';
import {deleteRecord} from 'lightning/uiRecordApi'

const actions = [
    { label: 'View', name: 'view' },
    { label: 'Edit', name: 'edit' },
    { label: 'Delete', name: 'delete' },
  ];
const columns = [
 //  { label:'Opportunity Name', fieldName: 'oppLink', type: 'url', typeAttributes: {label: {fieldName: 'Name'}, tooltip:'Go to detail page', target: '_blank'}},
   { label: 'Name', fieldName: 'Link',type:'url', typeAttributes: {label: {fieldName: 'Name'}, tooltip:'Go to detail page', target: '_blank'}}, 
   { label: 'Dealer_code__c', fieldName: 'Dealer_code__c' },
   { label: 'Dealer_Contact_Person__c', fieldName: 'Dealer_Contact_Person__c' },
   { label: 'Dealer_Mobile__c', fieldName: 'Dealer_Mobile__c' },
   { label: 'Dealer_E_Mail__c', fieldName: 'Dealer_E_Mail__c' },
   { label: 'Service_catgories__c', fieldName: 'Service_catgories__c' },
   { label: 'Transport_Assistance__c', fieldName: 'Transport_Assistance__c' },
   { label: 'Company_Contract_Start_Date__c', fieldName: 'Company_Contract_Start_Date__c' },
   { label: 'Company_Contract_End_Date__c', fieldName: 'Company_Contract_End_Date__c' },
   {
    type: 'action',
    typeAttributes: { rowActions: actions },
}, 
   
];
export default class OppTable extends NavigationMixin( LightningElement ) {
    @track error;
    @track columns = columns;
    @track opps; 
    @track showTable = false;  
    @track recordsToDisplay = []; 
    @track rowNumberOffset; 
    @wire(getDealers)
   
    wopps({error,data}){
        if(data){
            let recs = [];
            for(let i=0; i<data.length; i++){
                let opp = {};
                opp.rowNumber = ''+(i+1);
                opp.Link = '/'+data[i].Id;
                opp = Object.assign(opp, data[i]);
                recs.push(opp);
            }
            this.opps = recs;
            this.showTable = true;
        }else{
            this.error = error;
        }   
    }
    navigateToNewdealerPage() {
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Dealer__c',
                actionName: 'new',
              
            },
        });
    }
    handleRowAction( event ) {
        const actionName = event.detail.action.name;
        const row = event.detail.row;
        switch ( actionName ) {
            case 'view':
                this[NavigationMixin.Navigate]({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: row.Id,
                        actionName: 'view'
                    }
                });
                break;
            case 'edit':
                this[NavigationMixin.Navigate]({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: row.Id,
                        objectApiName: 'Dealer__c',
                        actionName: 'edit'
                    }
                   
                });

                break;
             //   window.location.reload();
            case'delete':
            var txt;
            var r = confirm("Are you sure you want to delete?");
            if(r == true){
               this.recordId = event.target.value;
               deleteRecord(row.Id) 
               .then(() =>{
           
                  const toastEvent = new ShowToastEvent({
                      title:'Record Deleted',
                      message:'Record deleted successfully',
                      variant:'success',
                     
                     
                     
                  })
                  this.dispatchEvent(toastEvent);
                 //return refreshApex(this.data);
                 
                 
                 
                 
                   

                
                 window.location.reload();
           
                 
                  
                  
               })
            }
               
               else{
                   txt ="you have selected cancel "
              
               }
               break;
            default:
        }
    }
      
  
    handlePaginatorChange(event){
        this.recordsToDisplay = event.detail;
        this.rowNumberOffset = this.recordsToDisplay[0].rowNumber-1;
    }
}

---------------------------------------------------------------------------------------------------

html:

<template>
    <lightning-card title="Data Table with Pagination">
        <template if:true={showTable}>
            
          <lightning-button label="New dealer" onclick={navigateToNewdealerPage} class="slds-float_left"></lightning-button> 
            <c-paginator records={opps} 
                        total-records={opps.length} 
                        show-search-box="true" 
                        onpaginatorchange={handlePaginatorChange}>
            </c-paginator>
            <lightning-datatable key-field="Id" 
                                data={recordsToDisplay} 
                                columns={columns}
                                onrowaction={handleRowAction}
                                hide-checkbox-column
                                show-row-number-column
                                row-number-offset={rowNumberOffset}>
            </lightning-datatable>
        </template>
    </lightning-card>
</template>

----------------------------------------------------------------------------------------------------
apex
public with sharing class OppTableContoller {    
    @AuraEnabled(cacheable=true)
    public static List< Dealer__c> getDealers() {
        return [SELECT Id, Dealer_code__c, Name, Dealer_Contact_Person__c, Dealer_Mobile__c, Dealer_E_Mail__c, Service_catgories__c, Transport_Assistance__c, Company_Contract_Start_Date__c, Company_Contract_End_Date__c FROM Dealer__c ];
    }
}


here i am performing lwc row actions edit and delete and serach operation in lightning data table with pagination my reuirement is when i delete a record i need modal popup message stating are sure u want delete and after delete it should automatically refreshed 

so plz help me 

thanks in advance

syed e h mazhari
mazharibobby829@gmail.com
8328174785

HI, Could you please guide me how to make the wrapper class object reactive in LWC js. 

I believe that @track properties are reactive but when I change the value of any property in `this.coreAttributes` js object, its not reflective in on `Save` button click 

Js file

import { LightningElement, track, api } from "lwc";
import queryCoreAttributes from "@salesforce/apex/P1PlantInfoPromptSolar.queryCoreAttributes";

export default class P1PlantInfoPromptSolar extends LightningElement {
@track coreAttributes;

connectedCallback() {
    queryCoreAttributes()
    .then(result => {
      this.coreAttributes = JSON.parse(result);
    }) 
    .catch({

    });

    this.promptSpecificAttributes = {
      noOfBlocks:"",
      flatHierarchy:false,
      drivePlus:false
    };
  }
saveP1PlantInfoPromptMetadataHandler(){
    console.log(' prompt specific att -> '+ JSON.stringify(this.coreAttributes));
  }
}
html file
<template for:each={coreAttributes} for:item="coreAttribute">
              <tr key={coreAttribute.key}>
                <th>{coreAttribute.attributeHeader}</th>
                <td>
                  <template if:false={coreAttribute.isPicklist}>
                    <input type={coreAttribute.attributeDataType} name={coreAttribute.attributeHeader}
                     value={coreAttribute.attributeValue}/>
                  </template>
                  <template if:true={coreAttribute.isPicklist}>
                    <select size="1" name={coreAttribute.attributeHeader}>
                      <option value="None">--None--</option>
                      <template for:each={coreAttribute.picklistValues} for:item="attributePickValues">
                        <option key={coreAttribute.key} value={coreAttribute.attributeValue}>{attributePickValues}</option>
                      </template>
                    </select>
                  </template>
                </td>
              </tr>
<lightning-button
        class="slds-m-left_small"
        variant="brand"
        label="Save"
        title="Save"
        onclick={saveP1PlantInfoPromptMetadataHandler}
      ></lightning-button>
            </template>


 
Hi Everyone.

I'm new to lightning and trying to open a datatable in a modal(popup). I have a requirement where when i check a checkbox, then a modal should open where data will be displayed from a certain object. I cannot figure out how to achieve this. I'm only able the display the datatable on the same page as of checkbox, and not in the modal.

Kindly siggest a solution. Thank you in advance.
HI I am building a Lightning Web Component (LWC)
I did all the edits and I have an array with ID and Perecentage(custom field). The array is marked with @track in the js file.
I am lost on how I can convert this array in APEX to a LIST so that I can update the data in APEX.

Thanks
Hello,
I'm using the lightning:dualListbox component, as described here: https://developer.salesforce.com/docs/component-library/bundle/lightning:dualListbox/example

I'm having troubles to adjust the height. My issue is that the number of items is limited (4), so it doesn't look nice:
User-added image

My question is: how I can reduce the white part (red arrow on the image)?

Code is like:
<aura:component>
    <aura:attribute name="options" type="List" default="[
        { label: 'English', value: 'en' },
        { label: 'German', value: 'de' },
        { label: 'Spanish', value: 'es' },
        { label: 'French', value: 'fr' }]"/>

    <lightning:dualListbox name="languages"  
                           label= "Select Languages" 
                           sourceLabel="Available" 
                           selectedLabel="Selected" 
                           fieldLevelHelp="This is a dual listbox" 
                           options="{!v.options}" 
                           onchange="{! c.handleChange }"/>

</aura:component>

Thank you!
Hi, I'm working with lightning:dualListbox , I would like to custom it because the label's options are too long. I haven't found how does it works...

This is an example of my lightning:dualListbox 
User-added image
Thanks in advance!

Regards
Hi I need help from a Lightning Guru.
I'm trying to use the lightning:dualListbox, the example of salesforce help is pretty easy, link.
What I need is to get the campaigns created in the system to select a few.
Here is my code: Component:
<aura:component access="global" implements="flexipage:availableForAllPageTypes" controller="MassEmailController">
<aura:attribute name="listOptions" type="List"/>
<aura:attribute name="selectedOptions" type="List"/>
<aura:handler name="init" value="{! this }" action="{! c.initialize }"/>
<div class="container slds-card">
    <header class="slds-card__header">
        <div class="slds-path">
            <div class="slds-grid slds-path__track">
                <div class="slds-grid slds-path__scroller-container">
                    <div class="slds-path__scroller" role="application">
                        <div class="slds-path__scroller_inner">
                            <ul class="slds-path__nav" role="listbox" aria-orientation="horizontal">
                                <li class="slds-path__item slds-is-current slds-is-active" role="presentation">
                                    <a aria-selected="true" class="slds-path__link" href="javascript:void(0);" id="path-1" role="option" tabindex="0">
                                        <span class="slds-path__stage">
                                            <!-- svg class="slds-icon slds-icon_x-small" aria-hidden="true">
                                                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#check" />
                                            </svg -->
                                            <span class="slds-assistive-text">Selected</span>
                                        </span>
                                        <span class="slds-path__title">Campaigns</span>
                                    </a>
                                </li>
                                <li class="slds-path__item slds-is-incomplete" role="presentation">
                                    <a aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-2" role="option" tabindex="-1">
                                        <span class="slds-path__stage">
                                            <!-- svg class="slds-icon slds-icon_x-small" aria-hidden="true">
                                                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#check" />
                                            </svg -->
                                            <span class="slds-assistive-text">Selected</span>
                                        </span>
                                        <span class="slds-path__title">Contacts</span>
                                    </a>
                                </li>
                                <li class="slds-path__item slds-is-incomplete" role="presentation">
                                    <a aria-selected="false" class="slds-path__link" href="javascript:void(0);" id="path-3" role="option" tabindex="-1">
                                        <span class="slds-path__stage">
                                            <!-- svg class="slds-icon slds-icon_x-small" aria-hidden="true">
                                                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#check" />
                                            </svg -->
                                            <span class="slds-assistive-text">Content</span>
                                        </span>
                                        <span class="slds-path__title">Content</span>
                                    </a>
                                </li>
                            </ul>
                            <div class="slds-path__scroll-controls">
                                <button class="slds-button slds-button_icon slds-button_icon-border-filled" tabindex="-1" title="Scroll left">
                                    <!-- svg class="slds-button__icon" aria-hidden="true">
                                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#left" />
                                    </svg -->
                                    <span class="slds-assistive-text">Scroll left</span>
                                </button>
                                <button class="slds-button slds-button_icon slds-button_icon-border-filled" tabindex="-1" title="Scroll right">
                                    <!-- svg class="slds-button__icon" aria-hidden="true">
                                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#right" />
                                    </svg -->
                                    <span class="slds-assistive-text">Scroll right</span>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <div class="slds-card__body slds-card__body_inner">
        <div id="step-campaigns" class="slds-is-expanded">
            <lightning:dualListbox aura:id="selectOptions" name="Select Campaigns"  label="Select Campaigns" 
                       sourceLabel="Available campaigns" 
                       selectedLabel="Selected campaigns" 
                       options="{! v.listOptions }"
                       value="{! v.selectedOptions }"
                       onchange="{! c.handleChange }"/>
        </div>
        <div id="step-contacts" class="slds-is-collapsed">
            <lightning:layout horizontalAlign="start">
                <lightning:layoutItem flexibility="grow">
                    <lightning:input type="email" label="Add recipient" name="email" />
                </lightning:layoutItem>
                <lightning:layoutItem flexibility="shrink">
                    <lightning:buttonIcon iconName="utility:add" variant="neutral" onclick="{! c.handleRecipientAdd }" alternativeText="Add" />
                </lightning:layoutItem>
            </lightning:layout>
            <table id="contacts-table" class="slds-table slds-table_bordered slds-table_resizable-cols slds-table_fixed-layout" role="grid">
                <tr class="slds-line-height_reset">
                     <th class="slds-text-align_right" scope="col" style="width: 3.25rem;">
                         <div class="slds-th__action slds-th__action_form">
                             <span class="slds-checkbox">
                                 <input type="checkbox" name="select-all" id="checkbox-all" tabindex="-1" value="off" />
                                 <label class="slds-checkbox__label" for="checkbox-all">
                                     <span class="slds-checkbox_faux"></span>
                                     <span class="slds-form-element__label slds-assistive-text">Select All</span>
                                 </label>
                             </span>
                         </div>
                    </th>
                    <th aria-sort="none" class="slds-is-resizable slds-text-title_caps" aria-label="Name" scope="col">
                        <span class="slds-truncate" title="First Name">First Name</span>
                    </th>
                    <th aria-sort="none" class="slds-is-resizable slds-text-title_caps" aria-label="Name" scope="col">
                        <span class="slds-truncate" title="Last Name">Last Name</span>
                    </th>
                    <th aria-sort="none" class="slds-is-resizable slds-text-title_caps" aria-label="Name" scope="col">
                        <span class="slds-truncate" title="Company">Company</span>
                    </th>
                    <th aria-sort="none" class="slds-is-resizable slds-text-title_caps" aria-label="Name" scope="col">
                        <span class="slds-truncate" title="Email">Email</span>
                    </th>
                </tr>
            </table>
        </div>
        <div id="step-content" class="slds-is-collapsed">
            <lightning:layout horizontalAlign="start">
                <lightning:layoutItem flexibility="grow">
                    <lightning:select name="select-template" label="Select a Template" required="true">
                    </lightning:select>
                </lightning:layoutItem>
                <lightning:layoutItem flexibility="grow">
                    <lightning:select name="select-sender" label="Select a Sender" required="true">
                    </lightning:select>
                </lightning:layoutItem>
            </lightning:layout>
            <lightning:input type="text" label="Subject" name="subject" />
            <lightning:inputRichText />
        </div>
    </div>
    <footer class="slds-card__footer">
        <lightning:layout horizontalAlign="spread">
            <lightning:layoutItem flexibility="shrink">
                <lightning:button variant="destructive" label="Restart" onclick="{! c.handleRestart }" />
            </lightning:layoutItem>

            <lightning:layoutItem flexibility="shrink">
                <lightning:button variant="neutral" label="Back" onclick="{! c.handleBack }" />
                <lightning:button variant="brand" label="Next" onclick="{! c.handleNext }" />
            </lightning:layoutItem>
        </lightning:layout>
    </footer>
</div>

The important part of component are the attributes and the lightning:dualListbox:
<div id="step-campaigns" class="slds-is-expanded">
            <lightning:dualListbox aura:id="selectOptions" name="Select Campaigns"  label="Select Campaigns" 
                       sourceLabel="Available campaigns" 
                       selectedLabel="Selected campaigns" 
                       options="{! v.listOptions }"
                       value="{! v.selectedOptions }"
                       onchange="{! c.handleChange }"/>
        </div>
Also here is the js controller of the component:
({
initialize: function (component, event, helper) {
    var campaigns = component.get("c.getCampaigns");

    campaigns.setCallback(this, function(response) {

        var state = response.getState();

        if (component.isValid() && state == 'SUCCESS') {                
            component.set("v.listOptions", response.getReturnValue());
        } else {
            console.log('Failed with state: ' + state);
        }
    });

    $A.enqueueAction(campaigns); 

},
handleChange: function (cmp, event) {
    // Get the list of the "value" attribute on all the selected options
    var selectedOptionsList = event.getParam("value");
    alert("Options selected: '" + selectedOptionsList + "'");
}

And my apex controller:
public with sharing class MassEmailController {

    @AuraEnabled
    public static List<Campaign> getCampaigns(){
        system.debug('getCampaigns Controller');
        List<Campaign> cpList = [SELECT  ID,NAME FROM Campaign];

        return cpList;
    }
}

So the problem is that when I assigned the response value to my attribute listOptions that is the parameter of options in the lightning:dualListbox where should go the list of available campaigns. The component is empty and no error is shown.
If someone has a solution and can help me I would appreciate it very much.
Thanks and best regards
 

Hi All, 

 I have requirement like .

I have one text box if user enters some text like 'AB' then it will search on Account,Contact and leads  objects .then it  shoud display values contanis 'AB'   in contact, account and Lead in Single pageBlock table?

 

  Search text:  'dynamic text' here is 'AB' then list should display like this 

 it should display in pageblocktable:

 

 

Objname  Name     City

 

Contact      abi           abudhabi

 

Account     test AB    chennai ab

 

 

Lead         abraham   raviab

 

 

Thanks,

 

 

Vicky