Set state field to read only for a new Incident

StewartF
Tera Expert

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!

1 ACCEPTED SOLUTION

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

View solution in original post

18 REPLIES 18

Service_RNow
Mega Sage

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!

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.

asifnoor
Kilo Patron

Hi,

You can create an UI policy and UI policy action through which you can set the state field to Readonly.

Attached is the screenshot for reference.

find_real_file.png

 

find_real_file.png

 

Mark the answer as correct and helpful if this helps.

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.