Getting error to fetch sctask using record query after create user step in ATF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello community,
I am creating ATF to test catalog item where I am trying to fetch sctask record using record query and giving condition request is (using data pill to get oder catalog item step) but it's fetching record when I run ATF by impersonating myself (admin) but when I create user with ITIL role, it gives error no record found matching query.
I am creating user after order catalog item step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
This is almost always ACL / visibility, not ATF “record query” logic from what I have seen .
When you run the test as admin the Record Query can “see” the sc_task. When you run as an ITIL user, the same query returns no rows because that user doesn’t have read access to that task common for sc_task/sc_req_item unless the user is the requester/beneficiary, assigned, in the assignment group, on the watch list, depending on your instance’s ACLs.
What to change at least one of these:
Best practice for ATF: Create the user before the “Order Catalog Item” step and place the order as that same user (Requested for / Opened by = that user). Then the task will be visible to them and your query will work.
If you must order as admin: After ordering, add a step that makes the ITIL user able to see the task (e.g., set assigned_to to them, add them to watch_list, or assign the task to a group they belong to).
If your goal is just validation (not user visibility): Run the fetch the SCTASK part in a server-side step (or keep that query under admin context), then only do UI assertions as the ITIL user.
Also note this as well: SCTASK creation can be asynchronous in some flows—so add a short Wait for Condition step wait until an sc_task exists for the RITM before the Record Query.
If you tell me what your query field is (e.g., request, request_item, or parent) and how you’re setting “Requested for,” I can point to the most likely ACL that’s filtering it.
@tanvipalkar - Please mark as Accepted Solution and Thumbs Up if you find Helpful!!