
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 02:36 AM
Hey,
I want to build a flow that I can use dynamically on multiple catalog items that should only create a task.
When using the "Create Catalog Task" I need to select a specific Catalog Item to specify the variables.
I simply want all Variables from the sc_req_item also to be visible on my task. Is there a way to create this dynamically?
Cheers,
Simon
#flowdesigner
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 06:46 AM
Hi @Simon Ohle ,
this is actually quite simple with a custom action.
Background: The assignment of variables to a catalog task is done in table "sc_item_variables_task", so you only have to add the variables here as records.
Sample script which you can use in a flow action with a "catalog_task" as input
(function execute(inputs, outputs) {
var sTaskID = inputs.catalog_task.getValue('sys_id');
var grRITM = inputs.catalog_task.parent.getRefRecord();
var aVariables = grRITM.variables.getElements();
aVariables.forEach(function (grVariable) {
grTaskVariable = new GlideRecord('sc_item_variables_task');
grTaskVariable.task = sTaskID;
grTaskVariable.variable = grVariable.getQuestion().id;
grTaskVariable.insert();
})
})(inputs, outputs);
In your flow you have to do the following:
- Create Catalog Task (Wait = false)
- Call your flow action "Add Variables to Catalog Task"
- Call action "Wait for Condition" which condition Catalog Task.Active = false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 08:32 AM
For anyone that comes across this post. Do as it says for the solution, it resolves EXACTLY what is needed for both the backend and the Employee Service Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 08:33 AM
I meant to say the 'Service Operations Workspace' not 'Employee Service Portal'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 01:17 PM
Hi Sebastian,
I have the same requirements as Simon but i have been unsuccessful getting your solution to work. Would you be able to take a peek?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 02:18 AM
Hey @Simon Ohle,
That's a good question tho. I do know that I've never really liked this "hard-coding" approach from ServiceNow and that you must specify the Catalog Item each time,
Depending on the quantity of Catalog Items you are going to have, it might be useful to think about one custom action which inserts values into question_answer table (and the related table) where the content of the Variable is stored. However, this would require some more designing and building a framework - which is not OOTB available.
Cheers,
Julian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 05:45 AM
Hey Julian,
have a look at Sebastians Solution. This works great!