2

I am updating the record in the javascript while clicking on custom button. I have custom date/time field Approved_Date__c. I need to update that fields also using javascript. How can I assign current date/time to Approved_Date__c field?

I tried like

set("Approved_Date__c",NOW());
set("Approved_Date__c",Date.NOW());
set("Approved_Date__c",Date.Time());

but i am getting:

A problem with onclick javascript for this button or link was encountered. Now not defined.

I tried like this also

jpt.Approved_Date__c=new Date().toLocaleString();

it's showing as:

{faultcode:'soapenvClient', faultstring:''3/21/2016, 3:05:33 PM' is notavalid value for the type xsd:dateTime',}

2
  • use a apex:inputhidden and set the value of that inputhidden Mar 21, 2016 at 10:25
  • I am not using any vf page. I am updating this in custom button in standard page. Mar 21, 2016 at 11:02

2 Answers 2

3

I got solution for this. I tried like this..

jpt.Approved_Date__c=new Date().toISOString();
2

I believe you are in the right direction. The only thing I see missing is the {! expression }.

I believe the first approach will work for you.

set("Approved_Date__c",{! NOW() });

1
  • Hi Manjit, that's also not worked for me. Mar 21, 2016 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .