Updating field using Javascript using a custom button

1. Create a button with label 'Add Employee'.

2. Select '

3. Select 'Execute JavaScript' as a behaviour.

4. Add the below code


var newRecords = [];

var a = new sforce.SObject("Account");

a.id ="{!Account.Id}";
a.NumberOfEmployees = {!Account.NumberOfEmployees} + 1;

result = sforce.connection.update(newRecords);


5. Click 'Save' button.

6. Add the button to the page layout.

It will increment the Employees.

No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit