- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2018 07:36 AM
Hello:
I have searched the Community for this and haven't been able to find quite what I'm looking for. I need to create a catalog item workflow script to set the due date of the item based on the date it was requested. If they select Project from the multiple choice question, I need it to set to 180 business days. If they select Support, I need it to set to 30 business days. Can anyone help me with the script I would need? (I'm not well versed at writing them yet.)
Multiple Choice variable: proj_support
Values: proj or support
Thank you for any assistance.
Monica Webster
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2018 08:17 AM
I figured this out - used the following:
if (current.variables.proj_support == 'support'){
var gdt = current.due_date.getGlideObject();
gdt.addDays(30);
current.due_date = gdt;
// Populate the Due Date on the REQ
var grREQ = new GlideRecord('sc_request');
grREQ.addQuery('sys_id', current.request);
grREQ.query();
if(grREQ.next())
{
grREQ.due_date = current.due_date;
//grREQ.description = current.variables.u_purchase_reason;
grREQ.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2018 07:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2018 05:05 AM
Here's what I tried but it's not working. Apologies, I'm not a scripter...
{
var field = current.variables.proj_support;
if(field == 'Project')
var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime(gs.nowDateTime());
gdt.setTZ(tz);
task.start_date = gdt;
var ed = new GlideDateTime(gdt);
ed.addDays(180);
task.end_date = ed;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2018 10:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2018 10:18 AM
Can anyone suggest what I should try? Thank you.