• Nicholas Patella
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I'm getting the below error whenever I try to do in-line editing of a picklist on an Account record. If I try to then change the picklist value and save the edits I get an invalid cross-reference ID error. Can someone please help me make sense of the source of the issue?

[NoErrorObjectAvailable] Script error.
a()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:948:169
{anonymous}()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:948:362
A.dispatchEvent()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:12:12146
e.LookupEventDispatcher.dispatchErrorEventFromLds()@https://dataminr.lightning.force.com/components/lightning/lookupUtils.js:2:17030
A.wiredRecordUi()@https://dataminr.lightning.force.com/components/lightning/lookup.js:2:8392
me()@https://dataminr.lightning.force.com/components/force/lds.js:2:16726
I created a List Button on the Contacts related list that allows users to select multiple Contacts and update a specified field, which then triggers an email alert to the selected Contacts (in this case, a survey). I wanted to add an additional validation check that does the following:
  • Check if the value of a specific field (Settings_Survey_Type__c) on all selected Contacts is null or not null
  • If any Contacts have a null value in this field, throw an error message
  • If all selected Contacts have a not null value in this field, continue executing the script
The thinking of adding the above is that this would allow me to determine which version of the survey to send based on the value in that field (which I can do via process builder). If it's blank, it wouldn't know which survey to send and should throw an error message.

Here is the current script:
{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}; 
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")}; 

if(confirm('Send survey(s) now?')) { 

var records1 = {!GETRECORDIDS($ObjectType.Contact)}; 
var newRecords = []; 
var contactRec = sforce.connection.query('select id,name,Send_Settings_Survey__c from Contact where id in (\'' + records1.join('\',\'') + '\')' ); 

var contacts = contactRec.getArray("records"); 
var arrayLength = contacts.length; 
if(records1==null || records1=='') { 
alert('No records selected'); 
} 
else{ 
for(var i=0;i<arrayLength;i++){ 
var con = new sforce.SObject("Contact"); 
con.Id = contacts[i].Id; 
con.Send_Settings_Survey__c = true; 
newRecords.push(con); 
} 

result = sforce.connection.update(newRecords); 
window.location.reload(); 
} 

}else{ 
}

I'm assuming I need to add the Settings_Survey_Type__c to the sforce.connection.query portion, but I'm not sure how to then check if that field is null or not for all Contacts in the array. Any ideas on how I would modify my script to add this check?
I am trying to create a custom button that will allow me to select one or more Contacts from the "Contacts" related list on an Account page and then execute JavaScript which will update a specific field (in this case, simply setting a checkbox value to "true") on each of the selected Contacts. I would then use the updating of this checkbox value to trigger a workflow that would send out an email alert to those Contacts.

Here is how I've configured the custom button:
User-added image
I've done a lot of searching around and found other posts about people trying to do a similar thing but for some reason the script I'm using just won't update that Contact field (doesn't throw an error, just refreshes the page without updating). Any ideas what I might be doing wrong here?
I'm getting the below error whenever I try to do in-line editing of a picklist on an Account record. If I try to then change the picklist value and save the edits I get an invalid cross-reference ID error. Can someone please help me make sense of the source of the issue?

[NoErrorObjectAvailable] Script error.
a()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:948:169
{anonymous}()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:948:362
A.dispatchEvent()@https://static.lightning.force.com/na62/auraFW/javascript/ReJ5V8Oa_EmHa1B_VZHK_g/aura_prod.js:12:12146
e.LookupEventDispatcher.dispatchErrorEventFromLds()@https://dataminr.lightning.force.com/components/lightning/lookupUtils.js:2:17030
A.wiredRecordUi()@https://dataminr.lightning.force.com/components/lightning/lookup.js:2:8392
me()@https://dataminr.lightning.force.com/components/force/lds.js:2:16726
I am trying to create a custom button that will allow me to select one or more Contacts from the "Contacts" related list on an Account page and then execute JavaScript which will update a specific field (in this case, simply setting a checkbox value to "true") on each of the selected Contacts. I would then use the updating of this checkbox value to trigger a workflow that would send out an email alert to those Contacts.

Here is how I've configured the custom button:
User-added image
I've done a lot of searching around and found other posts about people trying to do a similar thing but for some reason the script I'm using just won't update that Contact field (doesn't throw an error, just refreshes the page without updating). Any ideas what I might be doing wrong here?