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
troutguytroutguy 

How to update date record through System Log?

 

I’m trying to update a date field. What is the format to use?   My question is for 3rd line below:  used double quotes and that failed, used single quotes & that failed, tried putting data to be updated in different formats but they all failed. Running this through System Log in SFDC GUI.

 

 

opportunity ssr = [select id, name, contract_sign_date__c from opportunity where name = 'Upgrade Walkenig'];

System.debug('Results… ssr ' + ssr);

ssr.contract_sign_date__c = "2005-02-08";

update ssr;



Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Use

 this

 



opportunity ssr = [select id, name, contract_sign_date__c from opportunity where name = 'Upgrade Walkenig'];

System.debug('Results… ssr ' + ssr);

//YYYY MM DD

ssr.contract_sign_date__c = Date.newInstance(2005 ,02,08); 

All Answers

Shashikant SharmaShashikant Sharma

Use

 this

 



opportunity ssr = [select id, name, contract_sign_date__c from opportunity where name = 'Upgrade Walkenig'];

System.debug('Results… ssr ' + ssr);

//YYYY MM DD

ssr.contract_sign_date__c = Date.newInstance(2005 ,02,08); 

This was selected as the best answer
troutguytroutguy

Thanks - that worked!