- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 12:34 AM
Hi All,
Here i am trying to add 1 year and fetch result into u_next_verification_date. when i execute in the message it shows correct , but in the field value showing wrong.
Any help is highly appreciated.
Vass
When i update the record it is showing the correct date values in the message below.
But when i open the record and check the field value it showing wrong. (Highlighted field).
Also i wish the date value should be the blue rounded one hours/minutes/seconds.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 03:51 AM
Try Below Code,Its working fine
var gr = new GlideDateTime();
var gr1=gs.yearsAgo(-1);
var date= gr1.split(' ')[0];
var time=gr1.split(' ')[1];
var gd = new GlideDate();
gd.setValue(date);
date=gd.getByFormat('dd/MM/yyyy');
gr1=date+' '+time; //gr1 is your converted format
gs.addInfoMessage(gr1);
current.u_next_verification_date =gr1;
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 07:24 AM
Did you tried above code ?
Can you mark above answer as Correct if it solves your issue ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 07:12 AM
Hi,
Please use below code it is working for me
var date ="2016-10-12 07:11:23";
var split_date =date.split(' ');
var gd =new GlideDateTime();
gd.setDisplayValue(date);
gd.addYearsLocalTime(1);
var demp= gd.getDate();
var date_time = demp +" "+split_date[1];
gs.print( " date time after adding 1 year in actual date is "+date_time +" "+"only date is"+demp);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 07:13 AM
Hi,
Please mark this answer as Correct and Helpful.
Regards,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 07:41 AM
Hi Ravi,
That code is working individually and i modified that to assign the result to u_next_verifiation_date.But i am getting blank.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideDateTime();
//var gr1=gs.yearsAgo(-1);
current.u_next_verification_date = gs.yearsAgo(-1);
gs.addInfoMessage('gr1:' + gr1);
var date= gr1.split(' ')[0];
var time=gr1.split(' ')[1];
var gd = new GlideDate();
gd.setValue(date);
date=gd.getByFormat('dd/MM/yyyy');
//gr1=date+' '+time; //gr1 should be your converted format
current.u_next_verification_date = date+' '+time;
gs.addInfoMessage('gr2:' + current.u_next_verification_date);
Thanks
Vass

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2018 07:58 AM
Add below code:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideDateTime();
//var gr1=gs.yearsAgo(-1);
current.u_next_verification_date = gs.yearsAgo(-1);
gs.addInfoMessage('gr1:' + gr1);
var date= gr1.split(' ')[0];
var time=gr1.split(' ')[1];
var gd = new GlideDate();
gd.setValue(date);
date=gd.getByFormat('dd/MM/yyyy');
gr1=date+' '+time; //gr1 should be your converted format
current.u_next_verification_date = gr1;
gs.addInfoMessage('gr2:' + current.u_next_verification_date);