Getting error to fetch sctask using record query after create user step in ATF

tanvipalkar
Tera Contributor

 

 

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. 

6 REPLIES 6

Matthew_13
Mega Sage

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!!

Hii @Matthew_13 

Thank you for your response.

Query field is request on SC task table. 

I am setting requested for field on catalog  using data pill present in atf for setting newly created user ( end user).

I am creating two user one is end user who submit catalog form means after order catalog item step I am creating another ITIL user which will marked ac task as closed complete , for that I am fetching SC task.

So I want catalog to be submitted by end user and operation on SC task to be performed by ITIL user. So requested for is end user only. 

Could you please help me here.

Hii @Matthew_13 

I tried adding group while creating user. I used assignment group of sc task only. Still getting same error that record not found.

Hello @Matthew_13 

I tried adding group while creating user. I added same assignment group to which sc task is assigned. Still getting error.