Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Script Omit new Condition in List Control

Florian11
Kilo Sage

Hi all, I have a list field in a form where multiple users can be entered. In the Related List I would like that only users from the List field can create new records. Can anyone tell me how best to build the script for this?

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

var answer ;


if (parent.<field name with users>.indexOf(''+gs.getUserID())>-1) { //Do not remove the 'New' button
   answer = false ;
}
else { //Remove the 'New' button
   answer = true ;
}

answer ;

 

-Anurag

-Anurag

View solution in original post

2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Try this

var answer ;


if (parent.<field name with users>.indexOf(''+gs.getUserID())>-1) { //Do not remove the 'New' button
   answer = false ;
}
else { //Remove the 'New' button
   answer = true ;
}

answer ;

 

-Anurag

-Anurag

Vikram19
Tera Guru

Hi,

Try creating ACL of type create on that table to allow creation for certain list users.

Mark as Correct & Helpful, if applicable.

Thanks,

Vikram