Setting sc_task variables via workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2018 12:46 PM
I'm new to ServiceNow development and I am working on building out our first Service Catalog. When an item is ordered and the task generated on the sc_task table, I'm trying to set the Business Service and Catalog Item fields via workflow.
I have tried setting via script:
task.business_service = "Benefits";
task.cmdb_id = current.cat_item;
And via the Set Values options were I do get to select Benefits from the Business Service Dropdown. However, the field never gets populated and adding this step seems to cause the workflow to halt. (Also I want to be able to reuse this workflow for all items in the category Benefits so I need to be able to set the CI dynamically.)
It seems like there should be a very easy way to do this but my searches are turning up empty. Is there anyone who could point me in the right direction?
Many Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2018 12:51 PM
Update - I can now get the Business Service to populate via Set Values (human error on that one). Still stuck on the CI which I need to match with the Item Name.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2018 01:06 PM
Are you trying to set variables on the workflow task via a run script in the workflow? Or just setting the variables on the task in the workflow itself? Need some screenshots of where you are trying to do this.
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
‎11-06-2018 01:26 PM
I want to be able to reuse the workflow for all "Benefits" items. Therefore the CI needs to be entered based on the name of the Service Catalog item. I am therefor trying to set the value via script in the "Advanced Script" section of the Catalog Item task.
Is this what you needed?