- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 07:46 AM
Hi,
I currently have a business rule that prevents anyone that is not an itil_admin or admin from updating tickets if they are closed or resolved.
This is the setup:
One issue I have is that if we go to an existing ticket and attempt to change it to resolved or closed - it won't allow the change. We currently require work_notes to be populated for this action also.
What would be the simplest way to modify this rule so that it allows updates if the ticket changes to resolved / closed, but ONLY prevent comments and work notes whilst it is already at those states?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:34 AM
Can you try it like this:
!gs.hasRole('admin') && !gs.hasRole('itil_admin') && !current.state.changes() && (current.state == '7' || current.state == '8')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 10:06 AM
Can you share the script you are using? I think my condition should work.
It will only run your business rule script if the current state has not been changed by the current action, and the state is closed or cancelled. If the user has either admin or itil admin it will not run the business rule code.
In your condition with the '||' you need both roles. Because it checks if you do not have admin or itil admin. So it will run if you have only one missing.
If you can share the business rule script you have, I might be able to help with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 10:54 AM
Fixed it man - your condition only accounted for closed or cancelled, but our tickets go to resolved as well, so added !current.state == '6' and that's fixed it, thanks!
Final condition:
!gs.hasRole('admin') && !gs.hasRole('itil_admin') && !current.state.changes() && (current.state == '6' || current.state == '7' || current.state == '8')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 10:58 AM
You are welcome! Glad I could help! 🙂
And thank you for marking Correct and helpful. Really appreciate it!