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
John BraunJohn Braun 

Attempting to create a custom button that will update a field when clicked



I'd like to create a custom list button on the opportunity detail page, that when pressed, will update a field on the opportunity. I would like to try to use the "AJAX toolkit" to accomplish this but I'm not familiar with javascript.


Here is an example I was able to find but I'm not sure how to fill it out with my information. Would anyone be able to assist? Thanks so much:


var account = new sforce.SObject("Account"); = //set Record Id here, potentially get it from the URL ?id= param

account.field__c = value;
window.location.reload(); //to reload the window and show the updated values
Subhani PSubhani P



Check the following link for your reference.




Salesforce Certified Developer,