I am using the lightning:recordForm for creating the record   &lt;lightning:recordForm aura:id="recordViewForm"                               objectApiName="{!v.sObjectName}"                               columns="2"                               recordId="{!v.recordId}"                               layoutType ="Full"                               mode="edit"                               onsuccess="{!c.onSuccess}"                               onsubmit="{!c.onSubmit}"                               onload="{!c.onLoad}"                               onerror="{!c.onError}"/&gt;    onSuccess : function(component, event, helper) {     console.log('event response==='+ (event.getParams("response")).Id);    // this log statement returns --&gt; event response===undefined  }
108855
I am using lightning:recordEditForm and lightning:inputField for creating a new record. this component is being used inside a lightning community builder. When i click the submit button, i am able to create a new record in my custom object. However i need the created record ID as i need to pass it in the URL for the next page.
78345
Code  trigger CreatePerson on Contact (before insert) {     RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];      Map&lt;Contact, Account&gt; accounts = new Map&lt;Contact, Account&gt;();    for(Contact record: Trigger.new) {        if(record.AccountId == null) {            Account newPersonAccount = new Account();            newPersonAccount.FirstName = record.FirstName;            newPersonAccount.LastName = record.LastName;            newPersonAccount.RecordType = personAccountRecordType;             accounts.put(record, newPersonAccount);        }    }     insert accounts.values();     for(Contact record: Trigger.new) {        if(record.AccountId == null) {            record.AccountId = accounts.get(record).Id;        }    } }   Error  Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Can not select a person account".   How can I associate the recently created Person account with the Contact?
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;
118448
Is there a way to use force:createRecord but capture the redirect to the newly created record page that occurs after saving the record? Finally, prevent the redirect from completing?  createRecord : function (component) {     var createRecordEvent = $A.get("e.force:createRecord");     createRecordEvent.setParams({         "entityApiName": "Event__c"     });     createRecordEvent.fire(); }
121649
I am unable to pass parameter from the lightning controller to the apex class. Whenever I use debug the passed value seems null.  JavaScript Controller  add : function(cmp,event,helper) {      event.target.parentNode.style.display = 'none';     document.getElementById("cartdiv").style.display = 'block';     var selectedAccount =event.target.id;      var act = cmp.get("c.Cartveg");     act.setParams({"s":selectedAccount});     act.setParams({"cartlist" : cmp.get("v.cart")});     act.setCallback(this,function(a){         cmp.set("v.cartitem",a.getReturnValue());     });            $A.enqueueAction(act);     cmp.set("v.whichButton", selectedAccount); }   Apex Class  @AuraEnabled public static List&lt;Vegetable__c&gt; Cartveg(string s,List&lt;Vegetable__c&gt; cartlist) {       system.debug(s);   List&lt;Vegetable__c&gt;  clist= [SELECT Id, Name , Price__c , img__c                                  FROM Vegetable__c where Name =:s];      clist.addAll(cartlist);      system.debug(clist);     return clist; }   Value of s is null. Please help
77722
I am using Lightning toast messages in my lightning controller. But I am getting error like "Cannot read property 'setParams' of undefined"  Below is my code:  var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({    "title": "Error!",     "message": "Plase provide 'Part Number' to add to the list." }); toastEvent.fire();
94823
I am trying to create a button which will update a field value to null (RESET it). However, it's not working and not even giving any error. So when I click on the button, nothing happens.  lc.cmp:  &lt;aura:attribute name="myObj" type="Account" default="{'SObject':'Account'}"/&gt; &lt;lightning:input type="text" name="accountPhn" label="Enter Account Phone" value="{!v.myObj.Name}"/&gt; &lt;lightning:button label="Reset" onclick="{!c.resetMe}"/&gt;   lc.js:  resetMe : function(component, event, helper) {         //alert("Called");         component.set("v.accountPhn","");     }   Appreciate help around this.
62103
Are there a way to add callback after the user created a record and clicked the Save button?  I am using a custom tab and custom components and open the Create a record modal window using e.force:createRecord, but I was not able to find out how to attach callback to the event.  I even found :     Currently force:createRecord event does not accept any callback method or any after save event to handle custom action. Current force:createRecord always redirects to the newly created record. But in case if you want to just close the force:createRecord popup after save and refresh some other related component using the refresh is not possible.    So, is it really impossible? If so, what are current workarounds here?
9971
I'm trying to build a custom datable because I want the functionality to sort, search and paginate and also add action buttons in each row. Initially, my VF page was using  but we have now decided to rebuild that page in LWC.  I found a similar  but it hasn't really worked for me.  I then found  (Javascript) and  (ES2018) I have tried to implement Vanilla Datatables but I keep running into issues such as:      TypeError: Cannot read property 'length' of undefined   The above error is thrown because the library is unable to find the body of the table.   My point is that I feel this library won't work because it's using document, window and so on.   I was wondering if there is a way I could convert this library to something that is more suited to LWC basically have it "export" the modules. Since I'm not a JS expert I'm unable to put the pieces together.   Just for some context, I'll post my code here:  &lt;template&gt;     &lt;table class="sobject-table slds-table slds-table_cell-buffer slds-table_bordered"&gt;         &lt;thead&gt;             &lt;tr class="slds-line-height_reset"&gt;                 &lt;template for:each={fieldSetData} for:item="field"&gt;                     &lt;th key={field.apiName} title={field.fieldLabel} class="" data-scope="col"&gt;                         &lt;div class="slds-truncate" title={field.fieldLabel}&gt;{field.fieldLabel}&lt;/div&gt;                     &lt;/th&gt;                 &lt;/template&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;template for:each={records} for:item="row"&gt;                 &lt;tr key={row} class="slds-hint-parent"&gt;                     &lt;template for:each={row} for:item="data"&gt;                         &lt;td key={data.id} data-label="Name" data-scope="row"&gt;{data.value}&lt;/td&gt;                     &lt;/template&gt;                 &lt;/tr&gt;             &lt;/template&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/template&gt;   import {LightningElement, api, wire} from 'lwc'; import {processRecords} from 'c/recordGenerator'; import getFieldSetData from '@salesforce/apex/FieldSetData.getFieldSetData'; import getSobjectRecords from '@salesforce/apex/DeomoCTRL.getRecords'; import VanillaDatatable from '@salesforce/resourceUrl/VanillaDatatable'; import {loadScript, loadStyle} from 'lightning/platformResourceLoader';  export default class ManageSelectedIndicators extends LightningElement {     @api recordId;     records;     fieldSetData;     @wire(         getFieldSetData,         {objectName: 'SOBJECTName', fieldSet: 'FIELSETName'}     ) wiredFieldSetData({error, data}) {         console.log('wired called in Child')         if (data) {             this.fieldSetData = data;             this.getData();         }     }       constructor() {         super();         console.log('Constructor called in Child');     }      connectedCallback() {         console.log('Connected callback');     }      renderedCallback() {         console.log('Rendered callback');         Promise.all([              loadScript(this, VanillaDatatable + '/VanillaDataTables/src/vanilla-dataTables.js')          ]).then(() =&gt; {              const table = new DataTable(                  document.getElementsByClassName('.sobject-table'),                  //Also tried this.template.querySelector('.sobject-table'),                  {searchable: true, sortable : true}              );          })          .catch(error =&gt; {             console.log(error);          });     }      getData() {         getSobjectRecords ({             sobjectId: this.recordId         })         .then(response =&gt; {             this.records= processRecords(response, this.fieldSetData);         })         .catch((error) =&gt; {             console.log(error);         });     }  }   Edit: I have also tried lwc:dom="manual" that didn't seem to work either.  Is there any other way I could achieve these functionalities? Or do I have to write custom code to achieve this?
22584
Okay, i'm looking to see if I can get some help in understanding the documentation as laid out here:   I want to refresh a component after a record CRUD operation, the form is being populated from a call to an apex method. The data from this method (called with the @wire service) is then passed into a js function that splits the data into complete and incomplete todo items. Wire service call is:     @wire(getTodos, {     searchKey: '$searchString'   })   sendForSplitting({     error,     data   }) {     if (error) {       this.error = error;     } else if (data) {       this.splitTodos(data);     }   }   In an event handler i want to trigger an update to this dataset, the documentation above seems to reference that I can refresh the apex on a wired method. From that doc:      To refresh a wired method, you must pass the argument the wired method receives (which is the wired value).   To date, I have tried both:     handleCreate() {     return refreshApex(getTodos, {       searchKey: '$searchString'     });   }   and    handleCreate() {     return refreshApex(this.sendForSplitting({       error,       data     }));   }   Both of which throw errors - refresh failed because configuration is not available. How can I make this work? I want to ensure the lists update upon user interaction without having to resort to a manual refresh of the page...
19484
Am not doing anything fancy, just trying to update a field on Contact in JS of LWC but getting this exception.  Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'Name' throws at mydomain/auraFW/javascript/mhontaYdOya4Y_lBu7v9yg/aura_prod.js:2:27687  HTML Code:   &lt;template&gt;      &lt;template if:true={wiredContact}&gt;          {wiredContact.Name}          &lt;lightning-input value={wiredContact.Name} onchange={updateName}&gt;&lt;/lightning-input&gt;     &lt;/template&gt;  &lt;/template&gt;   JS:   import { LightningElement ,wire,track,api } from 'lwc'; import myContact from "@salesforce/apex/ContactController.fetchContact";  export default class Myrefreshapextest extends LightningElement {    @track wiredContact;   @wire (myContact)         fetchedContact({error, data}){             if(data){                 console.log(JSON.stringify(data));                 this.wiredContact = data;             }else if (error){                 console.log(error);             }     }      updateName (event){         console.log(JSON.stringify(event.detail.value));         console.log(JSON.stringify(this.wiredContact));         this.wiredContact.Name = event.detail.value;     }  }   Apex:  public class ContactController {      @AuraEnabled(cacheable=true)     public static Contact fetchContact(){         return [SELECT Id,Name FROM COntact LIMIT  1];     } }   On top of my head, am not doing anything wrong, anyone has idea what's wrong with my code?  When I print console.log(JSON.stringify(this.wiredContact)); I get old values so am pretty sure it exists.  I tried with @track and @api, but same response. Can anyone shed some light?
123596
I'm uploading records with the amazing dataloader.io and have a hard time to upload some records with NO value for optional fields. What do I have to put in those fields?   #N/A 'null' NULL '' "" 0   Is there a definite guide or reference document that answers this?
122548
I have a submit button in my form and I want to implement it using ajax:  function myid_user_page_form(){      drupal_add_library('system', 'drupal.ajax');     $form = array();     $form['id'] = array(        '#type' =&gt; 'fieldset',        '#title' =&gt; t('ID Information'),        '#prefix' =&gt; '&lt;div id="myid_search_id_number_wrapper"&gt;',        '#suffix' =&gt; '&lt;/div&gt;'    );       $form['submit'] = array(       '#type' =&gt; 'button',       '#value' =&gt; 'Save',          '#ajax' =&gt; array(          'event' =&gt; 'click',          'callback' =&gt; 'myid_user_page_form_ajax_submit',          'wrapper' =&gt; 'myid_search_id_number_wrapper'       ),        '#attributes' =&gt; array(         'id' =&gt; 'myid_save',                    ), );  function myid_user_page_form_ajax_submit($form, &amp;$form_state) {      watchdog('Wow','Wow'); }   After executing the code above, the page still has it's refresh after it's clickfunctionality. The ajax doesnt work and no Wow message log in my watchdog table from my database, which means the ajax callback function isn't called. Where am I missing?
90280
I am using LWCs to display lightning cards in a list.  The list shows information about Programs.  Each Program card has a button, and this button needs to take the user to the 'new object' screen of the Application object.  Here is my code:   applyToProgram(event) {     // The recordTypeId is coming from the .html     // I have verified that the value is correct.     var rtId = event.target.id;      // How do I use rtId below?     this[NavigationMixin.Navigate]({         type: 'standard__objectPage',         attributes: {             objectApiName: 'Application__c',             actionName: 'new',             nooverride: '1',             recordTypeId: rtId  // This does not work         }     }); }   This is not working.  The user is presented with the 'new object' screen for the object's default record type and NOT the one specified in rtId.  I tried putting 'nooverride' and 'recordTypeId' in the state:{} argument, and I also renamed 'recordTypeId' to just 'recordType'.  None of these worked.  Can anyone help me with the correct syntax?  Is this even possible in LWCs?  Thanks, Jeff
18924
I've just spent several hours trying to fix a deployment that was failing with the following extremely helpful error message:  Error: objects/Opportunity.object(2098,13):duplicate value found: &lt;unknown&gt; duplicates value on record with id: &lt;unknown&gt;   After a lot of Googling (which didn't help) and even more trial and error (which finally did), I've discovered that the question I really needed an answer to is...     If Salesforce gives me a "duplicate value found: &lt;unknown&gt; duplicates value found on record with id &lt;unknown&gt;", how can I figure out what's actually gone wrong?   There are several possible answers online, and a couple here on StackExchange, but without knowing how to narrow the focus after getting such a horrible, useless error message, it's too easy to fall for red herrings.
92503
I have a lightning component that is using ui:inputSelect.   The component code:              &lt;div class="slds-form-element__control"&gt;                 &lt;ui:inputSelect class="slds-select" aura:id="quals" change="{!c.getPreCodes}"&gt;                     &lt;aura:iteration items="{!v.questions}" var="q"&gt;                          &lt;ui:inputSelectOption aura:id="question" text="{!q.Id}" label="{!q.Question_Text__c}"/&gt;                     &lt;/aura:iteration&gt;                 &lt;/ui:inputSelect&gt;             &lt;/div&gt;   The controller:      getPreCodes : function(cmp, event, helper){         var selected = cmp.find("quals").get("v.value");          var action = cmp.get("c.getPreCodes");         action.setParams({             "qualID" : selected         });         action.setCallback(this, function(response){             var state = response.getState();             if (state === "SUCCESS") {                  console.log('precodes: ', response.getReturnValue());              }         });          $A.enqueueAction(action);     }   The basic logic is that the uiSelect is dynamically populated on init (this works fine). When a user makes a selection the "change" parameter function is fired to retrieve a list from the database and pass it to another component.   However, the change function {!c.getPreCodes} seems to be called recursively causing a      "Something has gone wrong. AuraClientService.postProcess: error in   processing [RangeError: Maximum call stack size exceeded] . Please try   again."   error. If I comment out the enqueueAction the function only runs once (nothing is called recursively) so I suspect it has something to do with the controller call.
2350
i have this attribute in my component:  &lt;aura:attribute name="currentRecordDuns" type="String" /&gt;    im trying to send it to the apex controller.  this is the javascript controller:  ({ doInit : function(component, event, helper) {         helper.getAccounts(component); },})     this is the helper:  ({ getAccounts: function(component) {             var action = component.get("c.getAccounts");     action.setParams({         "currentDuns": component.get("v.currentRecordDuns"),         "freeTextFilter": component.find("freeTextFilter").get("v.value")                 });     //Set up the callback     var self = this;     action.setCallback(this, function(actionResult) {         component.set("v.Accounts", actionResult.getReturnValue());                 });             $A.enqueueAction(action);                 },})   this is the apex code:  public class AccConListController {     @AuraEnabled     public static List&lt;Account&gt; getAccounts(String currentDuns,String freeTextFilter) {         String q = 'SELECT Id, Name,DunsNumber, (select name, Phone, Email FROM Contacts where Name like \'%' + freeTextFilter +  '%\' or Phone like \'%' + freeTextFilter +  '%\' or Email like  \'%' + freeTextFilter +  '%\') FROM Account  where DunsNumber=:currentDuns';         //q+= ' and Name like \'%' + freeTextFilter +  '%\'';         List&lt;Account&gt; accounts= Database.query(q);         return accounts;     } }   i didnt get the results i wanted, so i looked at the debug log and saw:     12:13:25:003 VARIABLE_ASSIGNMENT [19]|currentDuns|null   i have no idea why, please advise  EDIT: how do i assign a value to the currentRecordDuns: in my component i call:  &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}" /&gt;   this is doInit in the controller:  ({ doInit : function(component, event, helper) {         helper.getDuns(component);     helper.getLeads(component);     helper.getAccounts(component);      component.set("v.showContacts", component.find("checkboxContacts").get("v.value"));     component.set("v.showLeads", component.find("checkboxLeads").get("v.value")); },  })   the function the retrieves the currentRecordDuns:      helper.getDuns(component);   this is the function in the helper:  getDuns:  function(component) {       var action = component.get("c.getDunsByRecordId");     action.setParams({         "currentRecordID": component.get("v.recordId")             });     //Set up the callback     var self = this;     action.setCallback(this, function(actionResult) {         component.set("v.currentRecordDuns", actionResult.getReturnValue());                 });             $A.enqueueAction(action);  },   and this is the function in the apex controller:      @AuraEnabled public static string getDunsByRecordId(id currentRecordID) {      String q = 'SELECT DunsNumber FROM Account  where Id=:currentRecordID limit 1';     List&lt;Account&gt; accounts = Database.query(q);     return (!accounts.isEmpty()) ? accounts[0].DunsNumber : ''; }