- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 12:00 PM
We have an OnBoarding process where the hiring manager can select what software the new hire needs. The hiring manager selects from a List Collector. We have a workflow that creates a Catalog Task, which shows the list collector, and in right hand column has the software selected. I want to create two more Catalog tasks using a condition.
- If the software selected has, “Software2” in the list then create “Catalog task 2”.
- If the software selected has, “Software3” in the list then create “Catalog task 3”.
- The current Catalog Task which list all software select still needs to be create weather “Software2” or “Software3” is in the selected list or not.
I was looking at using the Switch Activity but not sure, if this will work and not sure, how to configure the Switch Activity if this what I need to use.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 12:20 PM
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 12:19 PM
Hi There,
you can use an if condition after the creation of your first catalog task and in that if condition activity you can filter your list collector variable using a script and based on the value of the if condition you can create catalog task 2 or catalog task 3.
Script to extract values from list collector can be used like this:
var myList = current.variables.my_variable.getValue(); // or using this workflow.variables.variableName
var myArray = myList.split(',');
for (var i = 0; i < myArray.length; i++) {
var gr = new GlideRecord('my_table');
if (gr.get(myArray[i])) {
// Do what you want to the retrieved record
}
}
You can refer the below thread as well:
Please mark this answer as correct and helpful if it resolved the query or of it lead you in right direction then just mark helpful alone.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 12:20 PM
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2020 08:38 AM
Thanks for the help Slava.