
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:00 AM
So, we've noticed an issue where, when creating an incident, if the state field is changed before the form is submitted/saved, the SLA timer doesn't actually start. Meaning we have had P2's technically breach the SLA, but reporting shows that it's actually made the SLA.
I've narrowed this down to ITIL users changing the state field to Active before the form is saved.
What I want to try and do it set 'state' to read only until the form has actually been submitted. Once it has, it can then be editable again.
I believe this would be best as a UI Policy rather than a Client Script?
Due to not being very clued up on scripting yet, I've been trying the standard way of setting fields, but nothing is working. Would anybody know the right script to use to make it work?
Any help would be greatly appreciated!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:33 AM
Hi Straut,
The UI policy provided by @Asif will work, just add a condition in the condition field as - State : is : New and Make Reverse If false True/Checked.
Regards,
Ajay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:07 AM
M
If you write Client script and UI policy on the same field. Client script will execute first. You can write either client script or Ui policy for the same action.
For more info refer the below link.
A Race between UI Policy and Client script
Note: Always use UI policy instead of Client script which is a best practice.
Please mark reply as Helpful/Correct, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:11 AM
That's great, but not what I was really asking for.
I need to write a script to set the state field as read only when it's a new record - as in, before it's submitted. That's what I'm struggling with.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:16 AM
Again, still not quite what I mean.
So yes, it sets the state field as read only, but permanently sets it that way. That's what I had in the first place, then trying to add in a condition on any field that might be updated when it saves, but it doesn't work on any that I tried.
It needs to be read only ONLY for when you are creating a new incident. Once you click 'Submit', or 'Save', the field then needs to be editable.