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();
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
Post a Comment