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
JuanTalJuanTal 

I can't update a custom field with a custom button

I have this but doesn't work

any ideas ?

 

 

{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")};

 

 

 

var caseObj = new sforce.SObject("Factura__c"); 
caseObj.Name = "{!Factura__c.Name}"; 
caseObj.Detalle__c = "005A0000001Sb6m";
var result = sforce.connection.update([caseObj]); 
window.location.href=window.location.href;

 

sfdcfoxsfdcfox

I propose that the most likely scenario is that you are neglecting to include the "ID" field, which would cause this type of error; you can never update a record without an ID value present.

 

Add the following code before your update call:

 

 

caseObj.Id = '{!Factura__c.Id}'