I've written simple code to update field on object by using javascript custom button, The field is read only from Page Layout. When i try for System Admin it works, but when i try for non-admin user it throwing Error. The code is ;


 var o = new sforce.SObject("Student__c");
 o.id = "{!Student__c.Id}";
 o.Laptop__c = true; 
 result =sforce.connection.update([o]);

 if (result[0].getBoolean("success")) {
 alert("record with id " + result[0].id + " updated");
 } else {
 alert("failed to update " + result[0]);


it throws me error as;

failed to update {errors:{fields:'Id', message:'Record ID: id value of incorrect type: fgggggggggg', statusCode:'MALFORMED_ID', }, id:null, success:'false', }

i'm trying to update page layout read only field from custom button, is it possible or not, i'm not sure. If it is possible then why it throwing eror.

  • I've create student object with checkbox field laptop. Field is readonly on layout. Profile2 has update access to student object. You button works. What is displaying for second profile in alert(o.id); ? Have you placed button on student layout? Jul 21, 2016 at 16:30


You must log in to answer this question.

Browse other questions tagged .