You need to sign in to do that
Don't have an account?
javascript button update field
I have a javascript button I am trying to create to update a picklist field on a custom object. Here is the code for the button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);
The code is not throwing errors on the object it is just not updating the field. The page is reloading. Anything wrong with the code?
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject('Projects__c');
p.id = "{Projects__c.Id}";
p.Status__c = "Closed";
result = sforce.connection.update([p]);
location.reload(true);
The code is not throwing errors on the object it is just not updating the field. The page is reloading. Anything wrong with the code?
All Answers
var p = new sforce.SObject("Live_Events__c");
p.StatusB__c= "Deleted";
result = sforce.connection.update([p]);
location.reload(true);
What I missed?
Is not working
Please Use This.
You have missed assigning the ID to variable
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var p = new sforce.SObject("Live_Events__c");
p.id = "{!Live_Events__c.id}";
p.StatusB__c= "Deleted";
result = sforce.connection.update([p]);
location.reload(true);
!Hope This will work..:)