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
T-007T-007 

how to save the button

I want to cancel the button with custom button in detail page, which makes the status field as 'cancel' .

(once the current user clicks cancel button in his/her detail page)

I want the detail description of this asap.

 

Thank you in advance.

Navatar_DbSupNavatar_DbSup

Hi,

You have to create a custom button for that and execute the JavaScript code. 

Try the below code as reference:

1. Click on your custom object.

2. Click on Button and Links.

3. Create a new button.

4. Execute the JavaScript code.

5. Try the below code as reference (made changes accordingly here CostomYesNo is custom picklist type field on account having Yes and No as Value ):

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")}

{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")}

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

v.CostomYesNo__c="{!Account.CostomYesNo__c}";

alert(v.CostomYesNo__c);

 

v.id = "{!Account.Id}";

alert(v.Date_Found__c);

if(v.CostomYesNo__c=="No")

{

alert('hi');

v.CostomYesNo__c='Yes';

result=sforce.connection.update([v]);

alert(result);

}

else if(v.CostomYesNo__c=="Yes")

{

alert('hi');

v.CostomYesNo__c="No";

result=sforce.connection.update([v]);

alert(result);

}

window.location.reload();

 

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.