new GlideDateTime(current.sys_created_on not copying to variables and posting back to records

Jeffrey Barton
Tera Contributor
I wrote the following business rule script to read the created date from the record and then update two custom fields with the created date but it doesn't seem to be working. 
 
Where did I go wrong?
 
(function executeRule(current, previous /*null when async*/ ) {
    var gcdt = new GlideDateTime(current.sys_created_on);
    var lreview = new GlideDateTime(Current.u_last_review);
    var anreview = new GlideDateTime(current.u_annual_standard_change_review_date);
    // set variable gcdt to current created date in system
    lreview = gcdt;
    anreview = gcdt;

})(current, previous);
5 REPLIES 5

Hi @Jeffrey Barton ,

 

Hope you are doing great.
After fetching the value in variable gcdt, lreview,anreview. you need to set the value using : 

current.field1 = anreview;

current.field2 =lreview;

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma