list edit

Shreshta_happy
Tera Contributor

I have written few client scripts and BRs on the form view for two fields ,

in which one field is read only integer(count) and the other is choice (reviewer),so depending upon the state field the reviewer and the count values will change.

for one state value the reviewer should be read only and this is working as expected in form view , but is not working on the list view.

 

 

ON FORM VIEW:

Shreshta_happy_0-1668771294847.png

ON LIST VIEW:

Shreshta_happy_1-1668771350981.png

 

in form view it is read only and list it is editable, please help me with the code .

 

 

 

1 ACCEPTED SOLUTION

OlaN
Giga Sage
Giga Sage

Hi,

Like mentioned by a couple of others before, a Client script only runs on the form view, not in the list view.

 

You can create a list edit ACL, that prevents users from editing the field in the list (example below).

Another option is to create a business rule that prevents users to save the record in the circumstances you mentioned (when the field should not be edited in the list).

But creating such a BR will not help with the issue that the field looks like it's editable in the list, the user can try to set the value, and will then receive an error message.
If you need the field to be read only, you will need to add the ACL record.

 

listedit-acl-example.png

View solution in original post

11 REPLIES 11

Yes . But the ACL is making the entire field as read only .

But my requirement is

 example : when the state is 1 then the value of reviewer is defaulted to none and should be readonly.

if we write an acl the entire field irrespective of choices, it is made as readonly .

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Shreshta_happy ,

You will have to make use of ACL for this.

For more info :https://www.servicenow.com/community/developer-forum/is-there-any-way-to-make-selected-fields-read-o... 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Yes . But the ACL is making the entire field as read only .

But my requirement is

 example : when the state is 1 then the value of reviewer is defaulted to none and should be readonly.

if we write an acl the entire field irrespective of choices, it is made as readonly

You can give conditions in ACL like state =1 or 2 in the conditions fields present in ACL


Raghav
MVP 2023

can i get the exact code