function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NattyForceNattyForce 

List View Button Not Working As Expected

I have a custom object that we put through the approval process and a custom button that allows for bulk approval from a list view. The button does not work for the designated approver but it will work for me, the administrator, and for users above the manager in the salesforce heirarchy. Is there something within salesforce preventing this functionality from working for the designated approver? We use custom approver fields if that makes any difference.

 

The button is an onClick JavaScript button, here is the script: 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit 
var url = parent.location.href; //string for the URL of the current page 
var records = {!GETRECORDIDS($ObjectType.Event__c)}; //grabs the Event records that the user is requesting to update 
var updateRecords = []; //array for holding records that this code will ultimately update 

if (records[0] == null) { //if the button was clicked but there was no record selected 
alert("Please select at least one record to update."); //alert the user that they didn't make a selection 
} else { //otherwise, there was a record selection 
for (var a=0; a<records.length; a++) { //for all records 
var update_Event = new sforce.SObject("Event__c"); //create a new sObject for storing updated record details 
update_Event.Id = records[a]; //set the Id of the selected Event record 
update_Event.Event_Status__c = "Approved"; //set the value for Status to 'Approved' 
updateRecords.push(update_Event); //add the updated record to our array 
} 
result = sforce.connection.update(updateRecords); //push the updated records back to Salesforce 
parent.location.href = url; //refresh the page 
}

 

The button simply changes the picklist value but does not work for the user designated as approver in the approval process field. 

 

-Natty