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
pradyprady 

custom button to update a field

hi

 

i have an customobject. i have a view created to show some records. i want to have an ability to update a field in the custom object to true for all selected records. i have a custom button created and have it included in the view layout

 

I am not sure how to go about doing the update using java script.  i have the behaviour as execute javascript and in onclick javascript i have

	{!Appointment__c.test1__c}='true'

 Test1 is the field which i want to update. check syntax give no errors but when i click the button its gives

A problem with the OnClick JavaScript for this button or link was encountered:

syntax error

 Any ideas, i dont mind using javascript or any other means to do a mass update.

 

Thanks

 

 

RadnipRadnip

You should be doing somehting roughly like this... not 100% on the syntax but should be close...

 

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

var acc = sforce.connection.query("Select test1__c FROM Appointment__c WHERE Id = '{!Appointment__c.Id}' LIMIT 1");
acc.test1__c = 'true';
sforce.connection.update(acc);