- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 12:56 PM
I'm new at the scripting world, so please forgive any simple mistakes. I'm struggling with a server script include that will dynamically add a number of days to a field using addDaysLocalTime. It is called fine from my client script. It reads the record fine and returns the exp_days variable, but...
On the gdt.addDaysLocalTime(exp_days), it works fine if I hard code a value like 14, but doesn't return anything if I use the variable. Thoughts? I've looked at this too long and could use a fresh set of eyes. Thanks!
Best,
Jon Becker
var MyDateTimeAjax = Class.create();
MyDateTimeAjax.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
nowDateTime: function () {
var sysID = this.getParameter('sysparm_sysID');
var gr = new GlideRecord('x_69046_lms_lmscatalog');
gr.get(sysID);
var exp_days = gr.expriation_days;
gs.info(exp_days);
var gdt = new GlideDateTime();
gdt.addDaysLocalTime(exp_days);
gs.info(gdt.getLocalDate());
return gdt.getLocalDate();
},
type: 'MyDateTimeAjax'
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 01:24 PM
Can you try this var exp_days = gr.getValue('expriation_days'); instead of var exp_days = gr.expriation_days;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 01:24 PM
Can you try this var exp_days = gr.getValue('expriation_days'); instead of var exp_days = gr.expriation_days;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 01:32 PM
Thanks! It works perfectly! It makes sense now I see the new line.
I appreciate it.