- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 08:49 AM
When I fill out information in catalog item form and then submit, it was able to pass values from catalog item variable to task fields to display value in Short Description and Description like this,
But when I use scheduled job script that execute it by filling information itself in catalog item, it show that it success filling data in catalog item in task requested item variables ticket but it couldn't pass value to display in Short Description and Description that cause blank,
Does anyone know why it show blanks in task description if execute scheduled job script but it show data in task description if I manually fill the data in catalog form?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 10:34 AM
Setting the variables from the scheduled job in that manner is going to happen on the Requested Item and not the task table, which is why the Task Short Description and Description are not populating. You need to set the Task Short Description and Description in the workflow itself and you can reference Requested Item variables to do so.
For example:
task.description = current.variables.group_name (if this is a reference filed add .getDisplayValue() on the end)
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 08:55 AM
Are you using this type of logic to populate your catalog item and submit it from a Scheduled Job?
var cart = new Cart();
//pass Catalog Item sys_id
var item = cart.addItem('9efcc297dbef7a0002e4fb761d9619f0');
//Set the Variables for Review
cart.setVariable(item, 'Service_type', 'annual_review');
cart.setVariable(item, 'requester', requester1);
cart.setVariable(item, 'existing_vendor', vendor);
//Submit Request
var rc = cart.placeOrder();
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 09:32 AM
Yes I did. I use,
var cart = new Cart();
var item = cart.addItem("8d72ac634fee9a005a152cee0210c759"); // ServiceNow Maintenance Request
//cart.setVariable(item, "src_requested_for", owner.manager);
cart.setVariable(item, "short_description", owner.manager.getDisplayValue());
cart.setVariable(item, "description", owner.name);
cart.placeOrder();
It was successful able to input in catalog item variables but couldn't pass values to task short description/description after submitted even though it does show it success entered under Requested Item Variables tab.
In task workflow script, I put,
var shortDesc = current.variable_pool.src_short_desc;
var longDesc = current.variable_pool.src_long_desc;
task.short_description = shortDesc;
task.description = longDesc;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 08:56 AM
what exactly have you written in your scheduled job?
i believe you did glide record to fetch the catalog variables value and on RITM level then updated into the task ?
or have you used cart API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 09:45 AM
I use glide record to pull group names from sys_user_group.
Then I use,
var cart = new Cart();
var item = cart.addItem("8d72ac634fee9a005a152cee0210c759"); // ServiceNow Maintenance Request
//cart.setVariable(item, "src_requested_for", owner.manager);
cart.setVariable(item, "short_description", owner.manager.getDisplayValue());
cart.setVariable(item, "description", owner.name);
cart.placeOrder();
It was successfully entered data in catalog item variables because it show in task Requested Item Variables tab but not able to pass value to task short description and description,
In task workflow, I did put
var shortDesc = current.variable_pool.src_short_desc;
var longDesc = current.variable_pool.src_long_desc;
task.short_description = shortDesc;
task.description = longDesc;