All the fields get read only when incident closed

nowitsvashu
Tera Guru
Please help me with this script(I've created a custom incident form)

function
onLoad() {
    //Type appropriate comment here, and begin script below
    var incidentState = g_form.getValue('state');
    var editableFields = g_form.getEditbleFields();

    if(incidentState == 7){
        for(var i = 0; i < editableFields.length; i++){
            g_form.setReadOnly(editableFields[i],true);
        }
    }
}
7 REPLIES 7

Mahesh23
Mega Sage

Hello,

 

Try UI policy instead of client script. 

I've to make a lot of UI Actions for it.

Community Alums
Not applicable

Hi @nowitsvashu ,

OOTB , the closed incidents have all the fields read only by default.

There is an ACL which is restricting the ITIL user to not allow closed incidents editable. In that ACL, there is a condition which allows to edit only if state is not closed/cancelled. Remove that condition and itil user is able to edit closed incidents as well.

https://your-instance.service-now.com/sys_security_acl.do?sys_id=66ec26370a0a0b0100a67b597d415b84&sy...

SandeepDutta_0-1708752546072.png

 

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Any reason for wanting to do this Client Side? You are aware that Client Side = not secure = user performance degradation? Why not doing this Server Side?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn