Update Record on Custom Button Using JavaScript on Detail Page

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

var DayPlanRecord = new sforce.SObject("Object Name");

 DayPlanRecord.id = "{!ObjectName.Id}"; 

DayPlanRecord.FieldName = false ;

 var recordType = sforce.connection.query("Select ID,FieldName, Name From ObjectName where FieldName = false " ); 

DayPlanRecord.FieldName = true ;
result = sforce.connection.update([DayPlanRecord]); 

window.location.reload();

Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page