The CreatorCon Call for Content is officially open! Get started here.

Make read only fields on incident

Yugandhar1
Tera Contributor

Hi All,

 

Recently we have one requirement, For incident, set read only fields on from level when below condition:-

1) Incident is active.
2)  User is not member of assignment group
3) Do not apply for users with admin role

 

I achieved by using ACL but client need on form level i know using client script we can achieve but i am not with coding any help in coding much appreciated.

1 REPLY 1

Vishal Birajdar
Giga Sage

Hi @Yugandhar1 ,

 

Do you want to use client script or business rule  ?

 

Below is the code by using business rule :

 

(function executeRule(current, previous /*null when async*/ ) {

        var active = current.active;

        var assignmentGroup = current.getDisplayValue('assignment_group');

        if (active == true && (!gs.getUser().isMemberOf(assignmentGroup)) && (gs.getUser().hasRole('admin'))) {
               //set fields readonly
            }

        })(current, previous);

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates