- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 01:05 PM
Working on a flow to unassign tickets from users with a specific role once they're deactivated.
I want to put in a check for a specific role so I'm doing a lookup record on the sys_user_has_role table, but unsure how to proceed to check if they actually have a role, and then using the status of that check in an if statement to update those records
Any suggestions would be helpful.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:37 PM
Hi @JordanDR,
If that's the case, I am assuming the trigger will be a user record.
e.g.
If so, the script can be something like:
var user = GlideUser().getUser(fd_data.trigger.current.user_name);
return user.hasRole('itil');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 02:14 PM
Hi @JordanDR,
Try the below:
- Create a True/False type Flow Variable
- Use Set Flow Variables Flow logic to set the variable via some script
- Use the IF Flow logic to validate if the variable is True or False
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 11:40 AM
Hey James,
Thanks for this! For this logic how would I get it to check the specific user? The trigger for the flow is if someone from a specific department is switched to inactive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:37 PM
Hi @JordanDR,
If that's the case, I am assuming the trigger will be a user record.
e.g.
If so, the script can be something like:
var user = GlideUser().getUser(fd_data.trigger.current.user_name);
return user.hasRole('itil');