I am populate a pick list value from design resource.But it is not loading value in the picklist. component:  &lt;aura:attribute name="Recordtype" type="String" access="global"/&gt; &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt; &lt;ui:Inputselect aura:id="Recordty" value="{!v.Recordt}"/&gt;&lt;br/&gt;   Controller js:  doInit : function(component, event, helper) {     var opts = [];             var inputsel = component.find("Recordty");             var recur = component.get("v.Recordtype");             for(var i=0;i&lt;recur.length;i++){             opts.push({"class": "optionClass", label: recur[i], value:recur[i]});         }         inputsel.set("v.Recordt", opts);     }    Design resource:  &lt;design:component&gt; &lt;design:attribute name="Recordtype" datasource="Account,Contact,Lead,Opportunity"/&gt;  &lt;/design:component&gt;
123532
I have a requirement to create a Lightning component that contains a ui:inputselect tag which will automatically fetch out its options from a custom pick list of an Object. How can this be achieved?
122028
I have a requirement where I use  in Lightning and I have implemented the same as below code. I created a Lightning Tab from this component and used in Lightning Experience. Component: &lt;aura:component implements=&quot;force:appHostable&quot;&gt;     &lt;ltng:require scripts=&quot;/resource/treeTable/treeTableJS.js&quot; afterScriptsLoaded=&quot;{!c.loadScripts}&quot;/&gt;     &lt;aura:attribute name=&quot;temp&quot; type=&quot;String&quot; default=&quot;none&quot; /&gt;     &lt;aura:attribute name=&quot;content&quot; type=&quot;String[]&quot; default=&quot;item1,item2,item3,item4&quot; /&gt;     &lt;table id=&quot;table&quot;&gt;         &lt;tbody&gt;             &lt;tr data-tt-id=&quot;parent&quot;&gt;                 &lt;td&gt;&lt;ui:button label=&quot;Click&quot; press=&quot;{!c.selectClick}&quot; /&gt;&lt;/td&gt;                 &lt;td&gt;Content&lt;/td&gt;             &lt;/tr&gt;             &lt;aura:iteration items=&quot;{!v.content}&quot; var=&quot;item&quot; indexVar=&quot;index&quot;&gt;                 &lt;tr data-tt-id=&quot;{!'child'+index}&quot; data-tt-parent-id=&quot;parent&quot;&gt;                     &lt;td&gt;&lt;/td&gt;                     &lt;td&gt;{!item}&lt;/td&gt;                 &lt;/tr&gt;             &lt;/aura:iteration&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/aura:component&gt;  Controller: ({     loadScripts : function(component, event, helper) {         $(&quot;#table&quot;).treetable({                 expandable: true             }, {                 force: true             }, {                 initialState: &quot;collapsed&quot;             });     },      selectClick : function(component, event, helper) {         if(component.get(&quot;v.temp&quot;)===&quot;none&quot;){             component.set(&quot;v.temp&quot;,&quot;plus&quot;);             $(&quot;#table&quot;).treetable(&quot;expandNode&quot;, &quot;parent&quot;);         } else{             component.set(&quot;v.temp&quot;,&quot;none&quot;);             $(&quot;#table&quot;).treetable(&quot;collapseNode&quot;, &quot;parent&quot;);          }     }, })  Now about the issue, when I use this in Lightning tab first time it works (meaning straight forward scenario), but now from this page I navigate to any standard record page (be it Accounts record page) or even Home page and come back to this lightning tab, it does not work. We have to refresh the page to make it work again. Any resolve so that we don't need to refresh the page? Please help. Note: Lightning Locker service is disabled.
38323
This code compiles but in preview, it shows an error Invalid selectOptions found. Use SelectOption type in Apex.   public list&lt;student__c&gt; myStud = new list&lt;student__c&gt;();    List&lt;student__c&gt; stud_qry = new List&lt;student__c&gt;();     public list&lt;student__c&gt; getStud(){         stud_qry =  [select Id, First_Name__c, name from Student__c];          for(student__c getEm : stud_qry){           myStud.add(new student__c(Name = getEm.first_name__c+' ' + getEm.name));            }            return myStud;    }   VFP  &lt;apex:outputText &gt;Select Student:&lt;/apex:outputText&gt;                 &lt;apex:selectList size="1"&gt;                      &lt;apex:selectOptions value="{!Stud}"/&gt;                 &lt;/apex:selectList&gt;
62289
I have fetched all the fields to be displayed on the datatable in my apex query.  In my js file where i store the column details  @track columns = [{         label: 'Deal Name',         fieldName: 'Marketing_Activity__r.Name',         type: 'text'                 },     {         label: 'Deal Type',         fieldName: 'Deal_Type__c',         type: 'text'      },     {         label: 'Rent',         fieldName : 'Rent__c',         type: 'currency'      },     {         label: 'Term',         fieldName : 'Term_Mos__c',         type: 'number'     },     {         label: 'Security Deposit',         fieldName: 'Aircraft__r.Lease__r.Security_Deposit_Amount_Cash_or_LOC__c',         type: 'currency'      }   It fetches value for rent,term and deal_type. but not for Security deposit and Deal Name. Any suggestions??? How to display the above details on the datatable in lwc?
49293
I have a lightning iteration component that shows several information on accounts in a row. One of the columns allows the user to choose a lookup( I use a custom lookup component) value to edit the account. I have another row that has a checkbox. What I am trying to accomplish is if the user clicks the checkbox, the column with the lookup value gets greyed out and is not allowed for editing. I tried to do this with a boolean attribute that gets turned to false if the checkbox is checked and then use an aura if to display the custom lookup component in the column but this ends up disabling the entire column. I need the row to have that column be disabled in THAT specific row is the checkbox in that row is checked. Below is code.  &lt;aura:iteration var="account" items="{!v.Accounts}" indexVar="idx"&gt;     &lt;tr class="slds-hint-parent"&gt;         &lt;th role="gridcell"&gt;             &lt;div class="slds-truncate" title="Acc"&gt;&lt;a href="{!'/'+ account.Id }" target="_blank" tabindex="-1"&gt;{!account.Name}&lt;/a&gt;&lt;/div&gt;         &lt;/th&gt;         &lt;td role="gridcell"&gt;             &lt;lightning:layoutItem size="4"&gt;                 &lt;aura:if isTrue = "{!v.show}"&gt;                     &lt;c:customLookupComp objectAPIName="Master_Customer__c"                         iconName="standard:account"                         selectedRecord="{!v.selectedLookUpRecord}"                         label="Search"                         fieldAPIName="Id"                         resultField1="Master_Customer__c"                         resultField2=""                         showlabel="false"                         /&gt;                     &lt;force:inputField  value="{!v.selectedLookUpRecords}"/&gt;                 &lt;/aura:if&gt;             &lt;/lightning:layoutItem&gt;         &lt;/td&gt;         &lt;td role="gridcell"&gt;             &lt;div class="slds-truncate" title="Parent acc"&gt;&lt;a href="{!'/'+ account.parentid }" target="_blank" tabindex="-1"&gt;{!account.Parent.Name}&lt;/a&gt;&lt;/div&gt;         &lt;/td&gt;         &lt;td role="gridcell"&gt;             &lt;label class="slds-checkbox--button__label" data-record="{!idx}"  onclick="{!c.masterCustomerCheckbox}"&gt;                 &lt;ui:inputCheckbox aura:id="button1" /&gt;             &lt;/label&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/aura:iteration&gt;   CONTROLLER  onLookupSelected : function(component, event) {     console.log('in lookupselected');     var selectedAccountGetFromEvent = event.getParam("selectedRecord");     console.log('in lookupselected2');     var recordsList = component.get("v.selectedLookUpRecords");     recordsList.push(selectedAccountGetFromEvent);     //component.set("v.selectedLookUpRecords" , selectedAccountGetFromEvent);      console.log('in lookupselected3');     var record = component.get("v.selectedLookUpRecords");   }, masterCustomerCheckbox : function(component, event, helper) {     console.log('in myfunc');     //var show = component.get("v.show");     //console.log('before show' + show);     //component.set("v.show", false);     //console.log('show ' + show);     var selectedItem = event.currentTarget; // Get the target object     var index = selectedItem.dataset.record; // Get its value i.e. the index This is because in the iterration i used index on it     var selectedacc = component.get("v.Accounts")[index]; // Use it retrieve the stored record     console.log('Acc Id ' + selectedacc.Id);      var masterCustomersToCreate = component.get("v.masterCustomerToCreate");     masterCustomersToCreate.push(selectedacc);      console.log('this is the master customer to create' + masterCustomersToCreate);      var action = component.get('c.createMasterCustomers');      action.setParams({         'accList': masterCustomersToCreate     })      action.setCallback(this, function(response) {         //store state of response         var state = response.getState();         if (state === "SUCCESS") {             //alert('Record Created');         }     });     $A.enqueueAction(action);    },
72134
This questions has been asked multiple times but there is not a workable solution to this problem.  Use Case: we are building a dynamic form rendering engine where we have sections, sub-sections and we are using record/record-edit forms to show fields and objects  on these sub sections. for each sub-section there is a custom object record from where we read fields and objects.  This is a managed package where someone can install and add their own configuration and the form will render in UI.  Problem: If there are complex use cases which record/record-edit forms cannot do we have also given a provision where in the same sub-section custom object record  , you can give your own custom component name. In aura, this worked since we can render dynamic components using create component function from javascript but it doesn't work in LWC since this method is not exposed.  Documentation says use slots/make the markup predictable but if this has to be a managed package and render dynamic components based on each client's need how can we have static markup in LWC since we wont know the component name before run-time.  Any thoughts or ideas on this would be truly appreciated
81707
We are migrating over to Lightning Web Components in the last couple of weeks now and we had some struggles with the arrays in Javascript. On a trackable array, when I call push in a wiredMethod, Array.push won't update the view. We found a workaround but I was wondering if there is a more elegant solution to this. Please take a look at the code snippets:  import { LightningElement, wire, track } from 'lwc'; import getData from '@salesforce/apex/LWCController.getData';  export default class myLWComponent extends LightningElement {     @track error;     @track dataArray = [];     @track processedArray = [];      @wire(getData)     wiredMethod({ error, data }) {         if (data) {             this.dataArray = data.arr;             this.dataArray.forEach(function (value) {                 // do some work on data here                 this.processedArray.push(value);             }         } else if (error) {             this.error = error;         }     }                  }   And on the view here:  &lt;lightning-card title="Card Title"&gt;     &lt;template for:each={processedArray} for:item='item'&gt;         {item.title}     &lt;/template&gt; &lt;/lightning-card&gt;   Here is our workaround:  export default class myLWComponent extends LightningElement {     @track error;     @track dataArray = [];     @track processedArray = [];      @wire(getData)     wiredMethod({ error, data }) {         if (data) {             this.dataArray = data.arr;             let tempArray = [];             this.dataArray.forEach(function (value) {                 // do some work on data here                 this.tempArray.push(value);             }             this.processedArray = tempArray;         } else if (error) {             this.error = error;         }     }                  }   As you can see from the work around, if we set array to the temp array, framework understands that the array is updated and updates the view accordingly. We also tried setting values as follows which didn't work:  this.processedArray[index] = value;   We are wondering why push doesn't work and/or if there is a better way to do this.
63671
Below is my code to create the component dynamically - The component is "ui:inputselect"  $A.createComponent(             RecoveryLineItem.Attributes[i].name,{                 "class" : "slds-input ",                 "aura:id" : 'ExampleId',                 "label" : RecoveryLineItem.Attributes[i].label,                 "multiple" : RecoveryLineItem.Attributes[i].multiple             }, ....   ..  console.log(component.find('ExampleId').get("v.value"))    Or console.log(component.find('ExampleId'))  is Giving as 'Undefined"  How to access the aura:id of the dynamically created components?
74626
I'm trying to fetch the contact record and showing on page using  its showing error      Unknown property EditContact_controller.wrapperClass.conList   Which thing is unknown.  here is my controller  public class EditContact_controller{     public List&lt;wrapperClass&gt; wrapClassList{get;set;}     public List&lt;contact&gt; conList;     public wrapperClass wc{get;set;}      public EditContact_controller(){         wrapClassList = new List&lt;wrapperClass&gt;();         conList = new List&lt;Contact&gt;();         conList = [SELECT Id, FirstName, LastName FROM Contact LIMIT 10];         For(Contact co : conList){             wc = new wrapperClass();             wc.flag = false;             wc.conWrap = co;             wrapClassList.add(wc);         }     }     public class wrapperClass{         public boolean flag{get;set;}         public Contact conWrap{get;set;}       }     }   Here is my VFPage  &lt;apex:page controller="EditContact_controller" tabStyle="Contact"&gt; &lt;apex:form id="frm"&gt;     &lt;apex:pageBlock title="Contact Records"&gt;          &lt;apex:repeat value="{!wrapClassList}" var="contactTable" id="cont_Table"&gt;             &lt;table&gt;                 &lt;tr&gt;                     &lt;th&gt; Action &lt;/th&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;th&gt; First Name &lt;/th&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                      &lt;th&gt; Last Name &lt;/th&gt;                 &lt;/tr&gt;                   &lt;tr&gt;                     &lt;td&gt; &lt;apex:inputCheckbox value="{!contactTable.flag}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;td&gt; &lt;apex:outputField value="{!contactTable.conList.FirstName}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;td&gt; &lt;apex:outputField value="{!contactTable.conList.LastName}"/&gt; &lt;/td&gt;                 &lt;/tr&gt;               &lt;/table&gt;                    &lt;/apex:repeat&gt;      &lt;/apex:pageBlock&gt;  &lt;/apex:form&gt;
31438
Can anyone please help me to understand the below code. I am not able to understand how we are  extracting value from map on visualforce page.  Actually i am trying to get the size of value list which is associated with respective key in map.              &lt;apex:outputPanel &gt;                 &lt;apex:repeat value="{!attributeWrapper.mapAllAttributesLabel}" var="M"&gt;                     &lt;div&gt;                         &lt;div&gt;{!attributeWrapper.mapLabels[M].Name} &lt;/div&gt;                         &lt;div&gt;                             &lt;ul&gt;                                 &lt;apex:repeat value="{!attributeWrapper.mapAllAttributesLabel[M]}" var="attribute"&gt;                                     &lt;li&gt;                                     &lt;p&gt;                                         &lt;apex:outputLink onclick="selectAttribute('{!attribute.attributeLabel.Label__c}','{!attribute.attributeLabel.Attribute__c}');return false;"&gt;                                            &lt;apex:outputLabel value="{!attribute.attributeLabel.Attribute__r.Name}"/&gt;                                         &lt;/apex:outputLink&gt;                                     &lt;/p&gt;                                     &lt;/li&gt;                                 &lt;/apex:repeat&gt;                             &lt;/ul&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/apex:repeat&gt;             &lt;/apex:outputPanel&gt;    public with sharing class AttributeWrapper {      public Map&lt;String, List&lt;AttributesLabelWrapper&gt;&gt; mapAllAttributesLabel{       // some code to populate this map     } }   If i do:  {!attributeWrapper.mapAllAttributesLabel[M].size}   I get an error so how do i get the size of value list on VF page?
8172
I have a picklist type outputfield on my visualforce page, i want when i select any value from this field some field will hide as per selected value.  &lt;apex:outputField value="{!oFormobject.C_Item_Married__c }" rendered="{!CONTAINS(sApiName, 'G2C_Item_Married__cN')}"&gt;           &lt;apex:inlineEditSupport showOnEdit="saveButton" event="ondblclick"/&gt;           &lt;apex:actionSupport event="onchange" reRender="personalInfo" /&gt; &lt;/apex:outputField&gt;   Thanks in Advance.
43780
I want to pass the java-script value to controller.I am using repeat on VF page.  VF page      &lt;apex:repeat value="{!listAdj}" var="Adj" id="hrs"&gt;       &lt;td&gt;&lt;div class="requiredInput"&gt;&lt;div class="requiredBlock"&gt;&lt;/div&gt;     &lt;apex:inputField id="decimal" value="{!Adj.Hours_Decimal__c}" onchange="setHidden5(this);" &gt;       &lt;/apex:inputField&gt;     &lt;/div&gt;&lt;/td&gt;             &lt;apex:inputField id="hours" value="{!Adj.Hours__c}" /&gt; &lt;apex:inputField id="decimal" value="{!Adj.Hours_Decimal__c}" onchange="setHidden5(this);"/&gt;              &lt;/apex:repeat&gt;   Javascript code  function setHidden5(element){     //split the id of the inputField by ':' and then use the 5th index in the array to exact position of the inputField in the apex:repeat.   var idArray = element.id.split(':');     var hiddenRep1 =document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":decimal");          var hiddenRep2 = document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":hours");       if(element.value.length &gt;=1){        document.getElementById("thePage:form:hrs:hrs:"+idArray[4]+":hours").disabled = true; **hiddenRep2.value=hidden1.value;**                }                             }     }   I want to pass the hiddenRep2.value to controller.How to pass that. Hidden2.value is same as hidden1.value + some addition subtraction.i dont know how to pass that value. Can someone me sort out this.  Thanks
91779
Can you please guide me best way to retrieve all active picklist values of all recordtypes of object. Can it be possible through API or any Apex Script.  I want something like below and i will write them in my file:  Obect Name, RecordTypeName, PicklistValues   Thanks
42604
here is my code in which i am trying to get the product name from opportunity line item but its returning back NULL value. can anyone please help me to get that product name. I can get id from product2 but i want the name of product so that i can abbreviate it and can store it in Order_Name__c field of orderItem. After adding the product only i am firing this trigger.     public class Procuct_Adding_To_Order{  public static void productOrder(List&lt;OpportunityLineItem&gt; oli){     system.debug('-----------------------');      set&lt;id&gt; prodset = new set&lt;Id&gt;(); for(OpportunityLineItem item : oli) {   prodSet.add(item.product2id); } // collect products Map&lt;Id, product2&gt; prodMap = new Map&lt;Id, Product2&gt;([select name from product2 where id in :prodSet]);   // create a map for OLIid &amp; corresponding Product Name Map&lt;Id, string&gt; OLIprodMap = new Map&lt;Id, string&gt;();  for(OpportunityLineItem item : oli) {  OLIprodMap.put(item.id, OLIprodMap.get(oli.product2id).name); //getting Error in this line. }      set&lt;Id&gt; setOppId = new set&lt;Id&gt;();      for(OpportunityLineItem obj: oli){          setOppId.add(obj.OpportunityId);      }      list&lt;opportunity&gt; needed = [Select Master_Opportunity__c from opportunity Where Opportunity.id =: setOppId];         List&lt;OrderItem&gt; orderIt = new List&lt;OrderItem&gt;();     for(Order ord: [Select id from Order where opportunityId =: needed[0].Master_Opportunity__c])       {        for(OpportunityLineItem o : oli)        {           OrderItem op = new OrderItem();          op.Opportunity_del__c = needed[0].Master_Opportunity__c;          op.orderId = ord.id;         op.Order_Name__c = o.product2Id;         system.debug('-----------------------3333333333333333333333'+ o.Product2Id);         op.PriceBookEntryId = o.PriceBookEntryId;         op.Quantity = o.Quantity;         op.UnitPrice = 100;         orderIt.add(op);            }          }     upsert orderIt;  } }
79320
For example, my component has the following section that displays a record form:  &lt;template if:true={showRecordForm}&gt;     &lt;lightning-record-form         object-api-name={sObjectApiName}         onsuccess={handleFormSuccess}         record-type-id={recordTypeId}         layout-type="Full"         columns="2"         oncancel={handleFormCancel}         onload={handleFormLoad}&gt;     &lt;/lightning-record-form&gt; &lt;/template&gt;   It will load the form for the object I specify in sObjectApiName, and with the specified record type as well. The problem is that I want to assign some values to specific fields.  Let us say that it is a Case form, and I want to assign an Account ID to the AccountId field, before the case is submitted to the platform.  I tried to query the lightning-input-fields, but with no success:  const inputFields = this.template.querySelectorAll(     'lightning-input-field' ); if (inputFields) {     inputFields.forEach(field =&gt; {         console.log(field)     }); }   This is a snippet from the .  I'm starting to think that this might not be viable, or too much trouble. Is there a way to do this?
54585
I've been working on a pretty complicated component, and I've had all kinds of trouble simply trying to identify which element is currently being used. After all sorts of experiments, I found a really nifty property on event, the "path" attribute. It seems to be a list of all elements that the event has gone through, and actually includes the data I'm looking for. However, I don't see this in the documentation anywhere, so I want to know if this attribute is reliable.  Here's some demo code:  &lt;aura:application extends="force:slds"&gt;     &lt;aura:attribute name="items" type="Integer[]" default="[1,2,3]" /&gt;     &lt;aura:attribute name="currentIndex" type="Integer" /&gt;     &lt;aura:iteration items="{!v.items}" var="item" indexVar="index"&gt;         &lt;div data-value="{!index}" &gt;             &lt;lightning:input onfocus="{!c.focused}" name="demo" label="Text" /&gt;         &lt;/div&gt;     &lt;/aura:iteration&gt;     &lt;lightning:input disabled="true" readOnly="true" type="number"                      value="{!v.currentIndex}" label="Last Focused Item" /&gt; &lt;/aura:application&gt;     ({     focused: function(component, event, helper) {         var index = event.path.reduce(             (a,c) =&gt; c &amp;&amp; c.dataset &amp;&amp; c.dataset.value !== undefined?              c.dataset.value: a, null);         component.set("v.currentIndex", parseInt(index));     } })     Does anyone know where I can find the documentation for this, or otherwise figure out if this supported behavior? I'd rather not use a feature that will be patched out of existence later, and it would finally solve  about how to actually use a supported method that doesn't involve using a class, style, or name attribute, which should ideally be used for their intended purpose.
80400
I was trying to migrate some standard fields like Account Type, Opportunity Type and Opportunity StageName with Migration Tool with API version 39.0 but am i don't see any pick list values in Metadata (Now named as ValueSet) for only Standard pick list fields.   Even i cross checked in IDE for the object,i dont see any values for those pick lists, is it known issue from Salesforce?