Set due date on catalog item depending on variable selection and calculating from submission date

MonicaW
Tera Guru

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

 

1 ACCEPTED SOLUTION

MonicaW
Tera Guru

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();

 }

}

View solution in original post

5 REPLIES 5

MonicaW
Tera Guru

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();

 }

}