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 Post

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

Select and Deselect Check Box on Page Block Table in Visual force Using JavaScript

Send SMS Using Batch Class in Salesforce