exam questions

Exam CAD All Questions

View all questions & answers for the CAD exam

Exam CAD topic 1 question 19 discussion

Actual exam question from ServiceNow's CAD
Question #: 19
Topic #: 1
[All CAD Questions]

Which method call returns true only if the currently logged in user has the catalog_admin role and in no other case?

  • A. g_user.hasRole('catalog_admin')
  • B. g_user.hasRoleExactly('catalog_admin')
  • C. g_user.hasRoleOnly('catalog_admin')
  • D. g_user.hasRoleFromList('catalog_admin')
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
kundgir
Highly Voted 3 years, 9 months ago
Answer is incorrect , It should be B
upvoted 14 times
...
nsmcan
Highly Voted 3 years, 8 months ago
Correct answer is B. There is no g_user.hasRoleOnly function
upvoted 14 times
...
esllin
Most Recent 3 weeks, 5 days ago
Selected Answer: B
g_user.hasRole('client_script_admin'); The example script checks to see if the currently logged in user has the capability to create and edit Client Scripts (client_script_admin role). Note that the script returns true not only when the currently logged in user has the role assigned but also if the currently logged in user has the admin role. The admin user has all roles implicitly assigned. To test whether the currently logged in user has the role explicitly assigned, use the hasRoleExactly() method: g_user.hasRoleExactly('client_script_admin');
upvoted 2 times
...
arango
1 month, 4 weeks ago
Selected Answer: B
Take a look of this https://servicenow.read.inkling.com/a/b/969eb76959534a84af3d0c2c58ba13ff/p/7b1eee5b6af844d08eeea8ccbecb08d5
upvoted 1 times
...
Nisha2706
10 months, 2 weeks ago
it's B
upvoted 1 times
...
chuks100
1 year ago
B is correct
upvoted 1 times
...
Klahr
1 year ago
B (https://developer.servicenow.com/dev.do#!/learn/courses/washingtondc/app_store_learnv2_scripting_washingtondc_scripting_in_servicenow/app_store_learnv2_scripting_washingtondc_client_side_scripting/app_store_learnv2_scripting_washingtondc_the_glideuser_g_user_class)
upvoted 1 times
...
manikanta_gnbv
1 year, 3 months ago
Selected Answer: B
B is Correct
upvoted 1 times
...
evoken
1 year, 5 months ago
Selected Answer: B
The g_user.hasRoleExactly() method in ServiceNow is used to check if the currently logged-in user has a specified role and no other roles. In this case, it checks if the user has the 'catalog_admin' role and no other roles. So, the correct method call to return true only if the currently logged-in user has the 'catalog_admin' role and in no other case is g_user.hasRoleExactly('catalog_admin')
upvoted 3 times
...
BugPanda
1 year, 7 months ago
Selected Answer: B
B is the correct one
upvoted 1 times
...
brutaltea
1 year, 8 months ago
Selected Answer: B
Correct answer is B, there is no hasRoleOnly methond in g_user
upvoted 3 times
...
Lord_Korvus
1 year, 9 months ago
Selected Answer: B
Correct answer is B, g_user.hasRoleExactly() Please find this g_user.hasRoleOnly() client side script that you speak of in the below ServiceNow documentation. I can wait. :D Source: https://developer.servicenow.com/dev.do#!/reference/api/utah/client/c_GlideUserAPI
upvoted 1 times
...
Mru9
1 year, 10 months ago
Answer is B
upvoted 1 times
...
Anu_K
1 year, 10 months ago
Selected Answer: B
Has role exactly.
upvoted 1 times
...
stophs
2 years, 1 month ago
Selected Answer: B
B IS CORRECT
upvoted 3 times
...
KAAAAARIM
2 years, 6 months ago
Can you guys update the correct answer? So far I've seen the "correct answer" be incorrect a little too many times and I'm not even a quarter of the way through these questions....the correct answer is B!!!
upvoted 3 times
...
g_user
2 years, 7 months ago
let it b, let it b...
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...