how do I Impersonate using script in ATF? Service-Now Orlando release
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 02:45 AM
Why do the step config 'Impersonate' not work in ATF in Orlando release. I tried in some of the test, but the Client Test Runner's page become unresponsive during the run. Also, I have noticed when I use the step config 'Impersonate', there is a warning saying- Impersonating an existing user may cause unexpected behavior for this test. Avoid potential issues by adding a 'Create a User' step instead. If someone is not supposed to use this step config, then why do it exist in the list.
'Create a user' is not so flexible, while working on a instance where there are lot of customizations.
Can somebody help me please. Its urgent.
Also, how do I Impersonate using script in ATF?
- Labels:
-
Facilities Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 08:01 AM
Hi Chandan,
Got it; Yes you are correct you can only set first name, last name, roles, groups for that user
so you can do this:
1) open the newly created user record using Open an Existing Record step and pass the sys_id of the previous step i.e. create user
2) set whatever fields you want as part of testing and then continue the testing
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2020 01:13 AM
Hi,
Is there any update on this? Is this question resolved or you need some more assistance.
Please consider marking appropriate reply as ✅Correct & 👍Helpful.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 06:53 AM
can you try?
if (gr1.next()) {
var user_sysid = gr1.getUniqueValue();
outputs.u_user = user_sysid;
//Impersonate
gs.getSession().impersonate(user_sysid);
// gs.getSession().impersonate(outputs.u_user);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 07:12 AM
Hi Prateek,
Just now, I tried that. But it did not impersonate the newly created user. The execution moved to next step with already logged in user, and after that progress bar didnot move.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 07:21 AM
Can you try to split them into two steps.
- User creation
- Impersonation
See if that helps.
Please mark my response as correct and helpful if it helped solved your question.
-Thanks