How to assign a catalog task based on the model category in alm_hardware table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 03:22 AM
we have to assign a catalog task to 'abc' group, if hardware asset assign to user has model category as 'Rugged Device'. And if its not rugged device the result will be no.
so we have written a script in IF activity in workflow, but it is not working as expected.
answer = ifScript();
function ifScript() {
var requestFor = current.requested_for.sys_id;
var category = 'Rugged Device';
var gr1 = new GlideRecord('alm_hardware');
gr1.addQuery('assigned_to', requestFor);
gr1.addQuery('model_category.name', category);
gr1.query();
if (gr1.next()) {
return 'yes';
}
return 'no';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 04:00 AM
Are you saying the IF activity is not resulting in the correct yes/no for the user being tested, or that the Catalog task is not correctly assigned, which would be outside of / after this activity?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 04:16 AM
Catalog task is not correctly assigned to group after IF activity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2023 05:19 AM
The IF activity is not doing anything to assign the group, so we'll need to see what the workflow looks like, and the details of the activities following the IF. It sounds like you don't need an IF activity, rather use your script within the Catalog Task activity to set the task.assignment_group to one value or another depending on the result of the GlideRecord.