In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?

In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?
A . g_form.hasRoleExactly(‘admin’)
B . gs.hasRole(‘admin’)
C . g_form.hasRole(‘admin’)
D . gs.hasRoleExactly(‘admin’)

Answer: B

Explanation:

Business Rule is server-side, so it uses GlideSystem API. gs.hasRoleExactly doesn’t exist

In a Business Rule, the following returns true if the currently logged in user has the admin role: gs.hasRole(‘admin’). This is the correct answer because gs is the GlideSystem object, which provides methods for performing system operations, and hasRole is a method that checks if the current user has the specified role. For example, gs.hasRole(‘admin’) will return true if the current user has the admin role, and false otherwise.

The following do not return true if the currently logged in user has the admin role in a Business Rule: g_form.hasRoleExactly(‘admin’). This is not correct because g_form is the GlideForm object, which provides methods for manipulating forms, and hasRoleExactly is a method that checks if the current user has exactly the specified role and no other roles. For example, g_form.hasRoleExactly(‘admin’) will return true if the current user has only the admin role, and false if the current user has the admin role and any other role.

g_form.hasRole(‘admin’). This is not correct because g_form is the GlideForm object, which provides methods for manipulating forms, and hasRole is a method that checks if the current user has the specified role or any role that contains the specified role. For example, g_form.hasRole(‘admin’) will return true if the current user has the admin role or any role that contains the admin role, such as admin_ui or admin_script.

gs.hasRoleExactly(‘admin’). This is not correct because gs is the GlideSystem object, which provides methods for performing system operations, and hasRoleExactly is not a valid method of the gs object. There is no method that checks if the current user has exactly the specified role and no other roles in the gs object.

Reference: Business Rules, GlideSystem, GlideForm

Latest CAD Dumps Valid Version with 60 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments