gs.hasRoleExactly('any_role') returning undefined

Jagadeesh_Maddi
Tera Contributor

while i was trying to make use of gs.hasRoleExactly('any_role') it was actually returning undefined can anyone please explain this 

3 ACCEPTED SOLUTIONS

Brad Bowman
Mega Patron

The hasRoleExactly method is not defined in the GlideSystem API, so that makes it undefined.

https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/... 

 

On client-side scripts you can use the GlideUser API: g_user.hasRoleExactly...

https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/... 

View solution in original post

miftikhar20
Kilo Patron

Hi @Jagadeesh_Maddi ,

 

hasRoleExactly() can be used in the client side scripting using g_form.hasRoleExactly()
The GlideUser (g_user) Class | ServiceNow Developers

 

On server-side scripting, you can use gs.hasRole().


If my response helped, please mark it as the accepted solution so others can benefit as well.

 

View solution in original post

Mohammed8
Tera Sage

Hi @Jagadeesh_Maddi 

@Brad Bowman   and @miftikhar20 have answered your question.

Also this is one of  important question for CAD certification . I have discussed about it in my article, you can have a read about it:

https://www.servicenow.com/community/developer-forum/article-3-understanding-servicenow-scripting-le... 

 

Thanks and Regards,

Mohammed Zakir

View solution in original post

3 REPLIES 3

Brad Bowman
Mega Patron

The hasRoleExactly method is not defined in the GlideSystem API, so that makes it undefined.

https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/... 

 

On client-side scripts you can use the GlideUser API: g_user.hasRoleExactly...

https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/... 

miftikhar20
Kilo Patron

Hi @Jagadeesh_Maddi ,

 

hasRoleExactly() can be used in the client side scripting using g_form.hasRoleExactly()
The GlideUser (g_user) Class | ServiceNow Developers

 

On server-side scripting, you can use gs.hasRole().


If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Mohammed8
Tera Sage

Hi @Jagadeesh_Maddi 

@Brad Bowman   and @miftikhar20 have answered your question.

Also this is one of  important question for CAD certification . I have discussed about it in my article, you can have a read about it:

https://www.servicenow.com/community/developer-forum/article-3-understanding-servicenow-scripting-le... 

 

Thanks and Regards,

Mohammed Zakir