ACL based on field value

Rosy14
Tera Guru

Hi,

I want to show the records if the user is a part of the auduience field. below code is not working.

 

 var cd_Audience = new sn_cd.cd_Audience();
 var visible = cd_Audience.isUserInAudience(current.u_audience, gs.getUserID());  // its checking if the loggedin user is belogs to audience field 
 //gs.addInfoMessage(visible);
 visible;
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Rosy14 

is audience field a list type? if yes then simply do this

answer = current.u_audience.toString().indexOf(gs.getUserID()) > -1;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader