- 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 08:17 AM
You have to work with an advanced/scripted condition:
!gs.hasRole('admin') && !gs.hasRole('itil_admin') && (!current.state.changes() && (current.state == '7' || current.state == '8'))
Meaning:
If user does not have admin and does not have itil admin and current state does not change and current state is closed 7 or cancelled 8. Execute your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:28 AM
I removed the basic conditions and added to the advanced one.
When trying to resolve a ticket it says resolved, then the message pops up saying it cannot be edited followed by invalid input.
This is just when saving from New to Resolved and includes work_notes and the resolution details
- 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 08:36 AM
Tried that before replying and had the exact same issue sadly, I'll see if changing the BR order number makes a difference at all
Oh just to clarify the roles condition works, it's just as a non-role user this occurs.
Edit: I added in the original conditions with your amendment above and now tickets will save and can be changed without any error messages
So this allows all changes for users
!gs.hasRole('admin') && !gs.hasRole('itil_admin') && !current.state.changes() && (current.state == '7' || current.state == '8')
And this prevents any changes even to 'New' tickets changing status
!gs.hasRole('admin') || !gs.hasRole('itil_admin') && !current.state.changes() && (current.state == '7' || current.state == '8')