- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2018 10:05 AM
Hello,
I have a workflow that runs on the sc_request table and is used to order catalog items. It creates catalog tasks. I am trying to pull the information from the RITM item field from a request in order to populate in the task's short description so that the help desk team can see what items need to be ordered more easily. I want it to capture multiple items in the request so I used a glide query. I place this script in the Advanced section of the catalog task, but when I run the workflow the fields that should be populating are showing up as undefined. Can anyone help me out? Thank you!
Here is the RITM page. I want to take the item field and put it into my catalog task's short description.
Here's the code I'm trying to use:
var item = new GlideRecord('sc_req_item');
item.addQuery('request', current.sys_id);
item.query();
while(item.next()) {
var catalogItem = item.cat_item.getDisplayValue();
}
var testing123 = task.short_description + catalogItem + ' X ' + item.quantity;
task.short_description = testing123;
Here's what happens when it runs (short description field shows undefined):
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2018 10:23 AM
Hi cfrazer,
It's seem to be you have used "request" instead of sys_id filed in addQuery();
I just changed request to sys_id in your code and ran(Background scripts) I got catalog item name.
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', '30d7b6dbdba3430077377bedbf961963');
item.query();
while(item.next()) {
var catalogItem = item.cat_item.getDisplayValue();
gs.print("DLM :Cat item::"+catalogItem);
}
Check it out below out put.
Hit Correct/ Endorsers/ Helpful/ Like depending on the impact of the response
Lakshmaiah Dumpala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2018 10:23 AM
Hi cfrazer,
It's seem to be you have used "request" instead of sys_id filed in addQuery();
I just changed request to sys_id in your code and ran(Background scripts) I got catalog item name.
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', '30d7b6dbdba3430077377bedbf961963');
item.query();
while(item.next()) {
var catalogItem = item.cat_item.getDisplayValue();
gs.print("DLM :Cat item::"+catalogItem);
}
Check it out below out put.
Hit Correct/ Endorsers/ Helpful/ Like depending on the impact of the response
Lakshmaiah Dumpala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2018 10:42 AM
Thank you for your help!!! That worked. I have another question for you please. When a person has multiple items in their request, it creates multiples catalog tasks for each item. Is there any way to put all the items bring ordered in one SC task?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2018 10:52 AM
You can achieve the order of sc_task's in workflow.