
- 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
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
12-03-2023 01:01 AM
@Sebastian R_ Hello Sebastian - your approach is excellent, this is exactly what I am trying to build for my Client right now. I would greatly appreciate if you could please post here/share a screenshot of your 'Flow Action' as far as how it looks in Flow Designer. I really need to see/understand what you have used as the Input, Steps and Output fields, I am trying to configure these fields correctly within the Custom Action in order to get this to work. Thanks so much Sebastian, I believe if I can see those field entries, then I will be able to fully get your 'Add Variables to Catalog Task' Custom Action to work. Many thanks kind sir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 10:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:26 PM
@Sebastian R_ thanks ever so much, this is excellent.
I configured your set up now and it all works perfectly!
Thank you for taking the time to share this solution and come back to me Sebastian. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 05:46 AM
Thanks, that was exactly what I was looking for!