Need script to add days (taking from dropdown field)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 03:09 AM
Hi Guys,
I Have one more requirement. Could you please help me on this,
i have one date field called invoice_date where i have one more field called day_s
where day_s has dropdown values like 10,15, 30 so on.
my result field = invoice_date + day_s
that is it has to add the days whatever there in the day_s field. and stored in my result field.
result field is a date field.
Is it possible? any idea?
Thanks in Advance,
Malaisamy Ji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 03:18 AM
Hello Malaisamy,
Yes it is possible.
Create a onChange script() on the dropdown field.
Once the value is changed, send the new value as the parameter to server side using ajax call.
1. Initialize a glideDateTime object with current date time as parameter like var gDt = new GlideDateTime(gs.nowDateTime())
2. convert the parameter into integer using parseInt();
3. gDt.addDays(parseInt(this.getParameter('selected_attribute')));
4. return gDt.getDisplayValue();
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 03:32 AM
Sudharsan,
I am new to service now. So could you please write the and give it to me.
So that i can use it.
Thanks,
Malaisamy J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 03:34 AM
Sudharsan,
I hope Glideajax will not work in scoped application. Please check that also
Malai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 03:49 AM
Please refer the following links
Client Scripts - ServiceNow Wiki
http://wiki.servicenow.com/index.php?title=GlideAjax#gsc.tab=0