You need to sign in to do that
Don't have an account?
update custom object record using javascript
Hello Helpers
I would like to update a record using jscript called from a custom button on a related list
I am building a dynamic SOQL statement, call sforce.connection.query(SQL), iterate through the result set, then try to update 1 field on each record in the result set
var SQLu = "Select Id,Status_vod__c from Event_Attendee_vod__c where id in (some ID values here);
alert(SQLu);
result = sforce.connection.query(SQLu);
alert(result);
records = result.getArray("records");
for(i=0; i < result.getArray("records").length; i++)
{
alert(result.getArray("records")[i].Status_vod__c); //I a just displaying to old value for test
result.getArray("records")[i].Status_vod__c = "Attended"; //this will be the new value
alert(result.getArray("records")[i].Status_vod__c); //I just check if the new value was set
sforce.connection.update(result.getArray("records")[i]); //THIS IS WRONG
}
what is the right syntax for sforce.connection.update(...) ?
can I update the records outside the for loop?
the record I want to update belongs to a custom object
Any suggestion is more then welcommed
Thanks in advance
csbaa
Hi
Replace your update statement with this,
Yes you can update the records outside the loop.