- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 02:02 AM
Hi,
We have a variable on a form that asks for the relevant CI name.
Whilst this variable shows in RITMs/ Tasks this doesn't automatically populate through to the existing inbuilt CI field which can be used in views / reporting.
We use the script below in a workflow to set this for RITM'S (and a similar script to pass through the requestor)
// Set CI
current.configuration_item = current.variables.configuration_item_ci_name_from_form;
I have ben unable to replicate this for tasks though and I'd like to be able to do so, this is in order that teams purely working on tasks can see which CI they have in their queue at a glance.
Does anyone have any ideas? simply lifting and shifting the script into a workflow task doesn't work.
Thanks
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 02:20 AM
Hi,
you must be using catalog task activity in workflow to create task
there you can use advanced script and set it
The field on sc_task is cmdb_ci
task.cmdb_ci = current.variables.configuration_item_ci_name_from_form;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 02:06 AM
Hello
You can populate the CI field on your Requested Item in a "Run Script" workflow activity with the following code:
current.configuration_item = current.variables.v_configuration_item;
current.update();
"configuration_item" being the name of the field on the RITM form
"v_configuration_item" being the name of the variable on the Catalog Item form
Thanks
Please mark my response as helpful and correct as applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 02:09 AM
For task use this.
var grRequest = new GlideRecord('sc_req_item);
if(grRequest.get('sys_id',current.request)){
task.cmdb_ci = grRequest.cmdb_ci;
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 02:20 AM
Hi,
you must be using catalog task activity in workflow to create task
there you can use advanced script and set it
The field on sc_task is cmdb_ci
task.cmdb_ci = current.variables.configuration_item_ci_name_from_form;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 03:25 AM
Thanks, will do some testing