How to verify whether the approval has been generated for the User's actual Manager through ATF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
When the User raise a Service Fulfillment Request through a given catalog Item, approval is generated for the User's Manager.
How can we verify whether the approval has been generated for the actual User's Manager or not.
I want to check through ATF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You can do Record Query on sysapproval_approver table with condition as user.manager to validate a approval.
This link should help you.
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Sorry, Remove the step 9: Record query, i added it twice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @VasundharaS0455 !!
Step 1: Impersonate User
Use a test user who has a Manager field populated
Step 2: Submit Catalog Item
Use Submit a Catalog Item ATF step
Capture the RITM sys_id in a test variable (example: ritm_id)
Step 3: Run Server-side Script (Validation)
(function () {
// Get RITM
var ritmId = steps.ritm_id;
var ritmGR = new GlideRecord('sc_req_item');
ritmGR.get(ritmId);
// Get Requested For user
var userGR = new GlideRecord('sys_user');
userGR.get(ritmGR.requested_for);
// Get Manager
var managerId = userGR.manager.toString();
// Validate approval for manager
var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sysapproval', ritmId);
approvalGR.addQuery('approver', managerId);
approvalGR.addQuery('state', 'requested');
approvalGR.query();
if (!approvalGR.hasNext()) {
throw 'Manager approval was not generated correctly';
}
})();Mark this as Helpful if it clarifies the issue.
Accept the solution if this answers your question.
Regards,
Vaishnavi
Associate Technical Consultant
