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

Hello,

 

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:

 

{!requireScript("/soap/ajax/26.0/connection.js")}
var account = new sforce.SObject("Account");
account.id = //set Record Id here, potentially get it from the URL ?id= param

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

Hi,

 

Check the following link for your reference.

 

http://boards.developerforce.com/t5/Java-Development/Custom-OnClick-JavaScript-Button-to-Update-Date-Field/td-p/254007.

 

Thanks,

Subhani,

Salesforce Certified Developer,

www.mydbsync.com.