
- 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:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:38 AM
Hi Straut,
The above client script will work exactly as per your requirement.
The g_form.isNewRecord will basically check if the form is new and only then it will make the state field readonly.
Kindly mark the answer as correct if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:16 AM
Hi straut,
You can use,
if (g_form.isNewRecord()){
//do this
}
Regards
Air

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 02:16 AM
Hi,
Write an UI policy for that..,without any condition.check script section and write below script.
function onCondition() {
if(g_form.isNewRecord()){
g_form.setReadOnly("state",true);
}
}
Mark correct or helpful if it helps you.
Warm Regards,
Pranay Tiwari
| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 05:37 PM
Helpful