You need to sign in to do that
Don't have an account?
bolaurent.ax1262
how to set a field to null from javascript remote?
I'm trying to set a database field to null from a javascript remote.
{!REQUIRESCRIPT('/soap/ajax/22.0/connection.js')} {!REQUIRESCRIPT('/soap/ajax/22.0/apex.js')} var __sfdcSessionId = '{!GETSESSIONID()}'; updater= new sforce.SObject("Account"); updater.id='{!Account.Id}'; updater.Stage_Expiry_Date__c = ""; resultC = sforce.connection.update([updater]);
Above does not work.
The API documentation for update says "add the field name to the fieldsToNull array in the sObject." But I can't seem to figure out how to to that from javascript:
updater.fieldstoNull.push("Stage_Expiry_Date__c");
Produces the message "updater.fieldsToNull undefined."
How can I set a field to null from javascript remotey?
Hi,
Try the below code snippet as reference:
{!REQUIRESCRIPT('/soap/ajax/22.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/22.0/apex.js')}
var __sfdcSessionId = '{!GETSESSIONID()}';
updater= new sforce.SObject("Account");
updater.id='{!Account.Id}';
updater. Stage_Expiry_Date__c= null;
resultC = sforce.connection.update([updater]);
window.location.reload();
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.