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.

How do we call isMemberOf() from clientside?

nthumma
Giga Guru

Any idea how to call isMemberOf() from client side (onLoad) or any alternatives ?

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi,



You can write a Display Business Rule on the required table and store the value in Scratchpad variable as mentioned below:



g_scratchpad.grp = gs.getUser().isMemberOf('');                   //Mention the name of the Group you want to check



Based on this scratchpad value you can check on the client side as required:



if(g_scratchpad.grp =='true')


{


......Write your validations here as required


}



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

9 REPLIES 9

shloke04
Kilo Patron

Hi,



You can write a Display Business Rule on the required table and store the value in Scratchpad variable as mentioned below:



g_scratchpad.grp = gs.getUser().isMemberOf('');                   //Mention the name of the Group you want to check



Based on this scratchpad value you can check on the client side as required:



if(g_scratchpad.grp =='true')


{


......Write your validations here as required


}



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

This is perfect for me, Thanks


This doesnt work in a business rule..

Gautam6
Tera Contributor

I have a variable (from variable set) on a service catalog that should be visible only to a group's members. How do it work for catalog item in service portal? Where should the BR be applied?

Thanks in Advance!