When I am using the gs.hasRole(); in the UI action it is not working properly.

venkatesh tadip
Tera Contributor

Hi Team,

 

When I am using the gs.hasRole(); in the UI action it is not working properly.

 

If(gs.hasRole("custom_role")){

 

}

Can you please let me know is it expected behavior or is there any alternative for this.

 

Thank you.

1 ACCEPTED SOLUTION

Mohan raj
Mega Sage

Hi @venkatesh tadip,

Check out the article below and the community question, which will be helpful to you.
Community Question: https://www.servicenow.com/community/developer-forum/anyone-had-luck-with-hasroleexactly/m-p/1619201

Article: https://joshneri.us/serverside-hasroleexactly-in-servicenow/

 

If my response helps you, please mark it as "Accept Solution" or hit the thumbs up to indicate it was helpful.

 

 

View solution in original post

2 REPLIES 2

Mark Manders
Mega Patron

What are you trying to do? Do you have a UI action that is performing different things for users with different roles?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Mohan raj
Mega Sage

Hi @venkatesh tadip,

Check out the article below and the community question, which will be helpful to you.
Community Question: https://www.servicenow.com/community/developer-forum/anyone-had-luck-with-hasroleexactly/m-p/1619201

Article: https://joshneri.us/serverside-hasroleexactly-in-servicenow/

 

If my response helps you, please mark it as "Accept Solution" or hit the thumbs up to indicate it was helpful.