Set requested item due date = user entered date variable

Hernan3
Kilo Contributor

Is there a way we can set the Due Date on the requested item to be equal to a date variable the user is entering? From what I read, the map to field feature is only available for record producers and it's currently not available for catalog items. Any suggestions would be appreciated.

1 ACCEPTED SOLUTION

ggiri1
ServiceNow Employee
ServiceNow Employee

Hi Hernan,



Create a business rule on sc_req_item table with order 1000 and before. Add condition item as your catalog item name.


write a script as below:



if(current.variables.<<date_variable>>)


  {


  current.due_date = current.variables.<<date_variable>>;


  }



Thanks,


Giri Guntoju


View solution in original post

8 REPLIES 8

ggiri1
ServiceNow Employee
ServiceNow Employee

Hi Hernan,



Create a business rule on sc_req_item table with order 1000 and before. Add condition item as your catalog item name.


write a script as below:



if(current.variables.<<date_variable>>)


  {


  current.due_date = current.variables.<<date_variable>>;


  }



Thanks,


Giri Guntoju


Hernan3
Kilo Contributor

Thank you, Giri. I created the business rule as advised and it seems to be changing the due date to 4 hours prior of the user entered due date. For example, instead of showing Due Date 06-07-2017, it shows 06-06-2017 20:00:00.



The workflow for this catalog item has an expected time of 14 hours. Would that have something to do with the business rule not changing the due date exactly to the user entered due date?


Hernan3
Kilo Contributor

Also, how can the catalog task have the same Due Date the user entered. It seems like the catalog task (out of the box) business rule titled "Auto Populate Request Field" is not copying the user entered due date that is on the RITM.


Community Alums
Not applicable

If you are using a Workflow to run the requested item,you can set it with a run script

 

current.due_date = current.variables.xxxxx; // xxxxx is the variable name that has the date you need