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

Use Of Standard Set Of Controller

How to remove and Delete row from PageBlock table on VF page

Show Pagination and Colum Sorting on VF page using Jquery Plugin