once form moved to close state should be not editable

pramn
Tera Guru

Friends , 

I have created 4 fields when its submitted and closed still user can edit those field .

what is the approch to make it non  editable once the form moved to close state ,

please help me with it 

 

Thanks 

 

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

Hi @pramn 
As it is only for four fields you can use UI policy and give correct conditions.

If we want to make all the fields read only you can use below logic:

var fields=g_form.getEditableFields(); //will return editable filed names in comma separated.
for(var i=0;i<fields.length;i++)
{
g_form.setReadOnly(fields[i],true);
}

Hope it helps..

 

Thanks,
Murthy

View solution in original post

4 REPLIES 4

Murthy Ch
Giga Sage

Hi @pramn 
As it is only for four fields you can use UI policy and give correct conditions.

If we want to make all the fields read only you can use below logic:

var fields=g_form.getEditableFields(); //will return editable filed names in comma separated.
for(var i=0;i<fields.length;i++)
{
g_form.setReadOnly(fields[i],true);
}

Hope it helps..

 

Thanks,
Murthy

Snow Learners
Kilo Guru

Hello @pramn ,

 

You can create write ACL for each field and add condition as "State is not closed". It will prevent users from editing those fields.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Sagar Pagar
Tera Patron

Hi @pramn,

 

It can be easily achievable using UI policy.

Condition as -

State IS Closed

 

UI policy actions -

Field1 --> read-only --> True

Field2 --> read-only --> True

Field3 --> read-only --> True

Field4 --> read-only --> True

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

The best approach is to create a  write ACL on those fields as below. Replace active with your field names and change the table name as well if you are using some other table.

 

Saurav11_0-1666762818942.png

 

Saurav11_1-1666762883163.png

 

Once done no user apart from admin will be able to edit those 4 fields nether from Form view or List view.

 

Please mark my answer as correct based on Impact