- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 12:49 PM
I am trying to create a somewhat "dynamic" ATF Test. Basically, I want it to go out to the Service Portal, and make a specific Catalog Item Request. This request will create a RITM that kicks off a workflow that has an Approval and a Task and then closes out.
So what I would like it to do is after I submit the request via the Service Portal, I would like to, on the ServiceNow side, is find the RITM (which we can dynamically do by capturing the ID of the submitted Catalog Item), and hopefully find the selected Approver for that RITM, and then Impersonate that Approver, and have that Approver open up that specific Approval, and approve it. But I am not sure how to do that dynamically.
Here is what I have so far, which creates the request from the Service Portal side, but I am kind of stuck on the next steps.
I know I could hard-code the Impersonation of the Approver (the workflow sets the Approver equal to the Manager), but I would like to figure out a way to dynamically determine the Approver from the submitted RITM. Is that possible?
And then, how can we get to the correct Approval record to approve?
Thanks
Solved! Go to Solution.
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 01:33 PM
Question... how do you know who the Approval Task is supposed to go to? Is it the Requestor's Manager? Or is it a member of an Assignment Group for the Catalog Item?
Requestor Manager Scenario - Use a 'Create User' step above your Requestor's 'Create User' step to create a manager called "Joe Manager". Do not impersonate. Then in your current Step 2 (new Step 3), reference the 'Manager' field to Manager 'Create User' step. Once the Request is submitted:
- Use the 'Record Query' step in the Request Item table to query the Requested Item whose 'Request' is (reference 'Order a Catalog Item' step)
- Impersonate the (reference Manager 'Create user' step)
- Then use another 'Record Query' in the Approval table to query the Approval whose 'Approval For' is (reference RITM 'Record Query' step)
- Use 'Open Existing Record' step to open (reference Approval 'Record Query')
- Use 'Click UI Action' step to click Approve, and done
Assignment Group Scenario - Use a 'Create User' step above your Requestor's 'Create User' step to create a user called "Joe Approver", and assign the Group to that user. Do not impersonate. Once the Request is submitted:
- Use the 'Record Query' step in the Request Item table to query the Requested Item whose 'Request' is (reference 'Order a Catalog Item' step)
- Impersonate the (reference Approver 'Create user' step)
- Then use another 'Record Query' in the Approval table to query the Approval whose 'Approval For' is (reference RITM 'Record Query' step), and 'Approver' is (reference Approver 'Create User' step)
- Use 'Open Existing Record' step to open (reference Approval 'Record Query')
- Use 'Click UI Action' step to click Approve, and done
Hope this helps. Let me know if you have questions!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 08:00 AM
Yup exactly! I do that too!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 12:39 PM
Thanks Gerald!
If you are up for another challenge, here is my latest ATF issue: https://community.servicenow.com/community?id=community_question&sys_id=21a7eef9db7fc8586064eeb5ca96...
I am hoping maybe it is actually an easy one, once you know how!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2021 03:59 AM
Hi Gerald,
I am new to ATF testing. I have followed the above steps mentioned by you and it came out successful. Thank you!
I am now creating test cases for Incident ticket creation and checking SLA. I have some issues regarding that,
1. When I select 'Submit a form' step, It throws me an error ("FAILURE: Failed to submit 'incident' form using the 'Save' action") and recordnot found.
2. So I tried using "click a UI action". Now the test case is successful, but when I continue with SLA steps its again throwing the same error that "Incident table doenst have the record".
I have attached the steps screenshot. If I have to continue with resolution sla, which step I should use after saving the form.
Kindly help me resolve the issue.
Thanks,
Rini