+ Start a Discussion
Suresh RaghuramSuresh Raghuram 

Date in the button code not populating

Hi Community,

I am trying to populate  a datetime value from the custom javascript button on a standard pagelayout.
I can populate the check box but datetime field is not getting a value.
any help is appricated.

var UpdateRtProd = new sforce.SObject("RtProd__c");
                        var datTime = '{!NOW()}';

                        HERE THE datTime IS COMMING in the following format 2/05/2015 11:44 AM
 
            UpdateRtProd .Id = RatingProdsRecords[r].Id;
            UpdateRtProd .UWRTR_IND__c = true;
            UpdateRtProd .UWRT_SUBMT_TS__c = datTime ;
            UpdateRtProd .push(update_RatingProduct);
result = sforce.connection.update(UpdateRtProd );
 
Best Answer chosen by Suresh Raghuram
KaranrajKaranraj
Can you try adding new Date() for that datetime field
UpdateRtProd .UWRT_SUBMT_TS__c = new Date(datTime);




   
 

All Answers

Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello,

Please, refer to the links below:

https://success.salesforce.com/answers?id=90630000000gsEMAAY (https://success.salesforce.com/answers?id=90630000000gsEMAAY" target="_blank)

https://developer.salesforce.com/forums/ForumsMain?id=906F00000009BDIIA2 (https://developer.salesforce.com/forums/ForumsMain?id=906F00000009BDIIA2" target="_blank)

Regards.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
KaranrajKaranraj
Can you try adding new Date() for that datetime field
UpdateRtProd .UWRT_SUBMT_TS__c = new Date(datTime);




   
 
This was selected as the best answer