- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 03:50 AM
Hello,
I need to query a table according the user's answer on the request, but up to now I was not successful, can somebody help me to right a script that can query the table according reference field on the Catalog item?
Specifically, the user needs to select on the reference field of the catalog item the name of desired software to be uninstalled. There are more than 100 selectable choices, and according the user's answer I have to create a if condition on the workflow.
and the IF statement should be something like:
If the 'selected software' of 'variable' needs a 'license' and 'license is central', return YES than create a task to 'specific group name', if return NOT create a task to 'service desk'.
Thank you.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2022 01:18 AM
Hi Suellen,
If my answer solved your query then please mark it correct as well. So that this question can go away from unanswered queue and others can get benefited from the same.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 04:33 AM
You can create an if activity and write a script there as below:
Based on the result of your if activity, you can create task by using create catalog task activity and attach it yes and no responses.
answer();
function answer(){
var soft = new GlideRecord('software table name');
soft.get(current.variables.u_selected_software); // in place of u_selected_software provide the name of the variable.
if(soft.licence=='central')
{
return 'yes';
}
else
return 'no';
}
Please mark this correct and helpful based on the impact.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2022 01:18 AM
Hi Suellen,
If my answer solved your query then please mark it correct as well. So that this question can go away from unanswered queue and others can get benefited from the same.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)