Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Want to impersonate a user that is referenced in a field from a previous step, where I opened a form

dhirajmishr
Giga Contributor

Hi Team,

 

I am working on ATF in Zurich release for an GRC module.

 

I want to impersonate a user that is referenced in a field from a previous step, where I had opened a form using ATF. 

Please find the attached screenshot for the same.

 

Also, please assist how can I create ATF test case for assessments in GRC module.

 

Thanks in advance.

1 ACCEPTED SOLUTION

@dhirajmishr 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron

Hi @dhirajmishr 

I think you need to fix the impersonation user  in ATF. We can’t proceed based solely on the record.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@dhirajmishr 

Steps

1) Use "Run Server Side Script" step and use this script

  // give sysId of the previous step here
    var incRecordSysId = steps('c056cd85c317bed05b9c7fedd4013195').record_id;
    var gr = new GlideRecord("incident");
    gr.addQuery("sys_id", incRecordSysId);
    gr.query();
    if (gr.next()) {
        outputs.table = 'sys_user';
        outputs.record_id = gr.assigned_to;
        stepResult.setOutputMessage("Assigned to user found " + gr.assigned_to.name);
        return true;
    } else {
        stepResult.setOutputMessage("Record not found");
        return false;
    }

In below image you need to remove toString() from script which I already did above and return true, false is also to be corrected

55.png

2) Impersonate User step picks that assigned to user dynamically and impersonates with that from previous step

55.png

Steps look like this

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@dhirajmishr 

Steps

-> I created new INC and set some field values and Submitted the form

-> then I used Server Side Script Step to grab the assigned to of that INC and took output from Submit a Form step

-> then I impersonated with that assigned to user55.png

see working output I attached as gif

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@dhirajmishr 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader