ATF Catalog Item Approval Issues

someone_passing
Kilo Contributor

Hello,

I am trying to update the record and approve it but I am running into couple problems. I followed this tutorial from servicenow, but it is not working. I am using Kingston btw.

The TL;DR version is, how do you approve a catalog item record. What are the steps for it? The tutorial I linked did not help me.

The long version is below.

What I am trying to do:

In ATF, I want to open a catalog item, set the values, submit it and go through the multiple approval process of the record.

 

What I did:

First Approach

I created a test file, say Test 1. What I first tried to do in Test 1 is:

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item <-- Successful up to this point
  5. Impersonate (as User 2)
  6. Record Query <-- Failing here saying (1** see below)
  7. Record Update

 

Second Approach

I created two test files. One is Test 1 and Test 2.

In Test 1:

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item

In Test 2:

Before I start Test 2, I go to the table where the record was created from Test 1 and paste into the Replay Request Item as shown in the tutorial in Test 2. It defeats the purpose of Automation if I have to do something manually, but I just want to pass the test, but it still doesn't work.

  1. Replay Request Item (paste the RITM number I got from the record)
  2. Impersonate (as User 2)
  3. Record Query <-- Again, failing here (2** see below)
  4. Record Update

I have more approvals I need to go through, but for now, I just want only one approval working before I proceed.

 

Problems I am running into:

1** On my first approach, I am trying to get it approved from sysapproval_approver table. I am trying to find the record using the RITM number, but I get an error saying it couldn't find the record but it shows it was looking using the REQ number and not the RITM number. The condition I put was Approval for | is | Step 4: Order Catalog Item > Request

 

2** On my second approach, the problem I am running into the same problem as above. The table is same but the condition is a little different. The condition is Approval for | is | Step 1: Replay Request Item > Replayed Request Item > Request and instead of searching the record using the RITM number, it is looking it up using the REQ number.

 

I did more testing and I was running into more weird problems, but if I mention all that, the post will get really long and I doubt anybody will read it. So my question is, how do you get the record to approve in ATF?

 

Thanks

 

Update: Follow up post to this with more questions is here.

1 ACCEPTED SOLUTION

bbf3562
Kilo Guru

Here is what I would suggest as it working on my side for approval,

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item
  5. Record Query -> To get RITM record using Req ID from #4
  6. Record Validation - > to ensure that RITM exist and the stage is approval
  7. Record Query - > To get Approval(sys_approval) record using RITM ID from #5
  8. Impersonate -> impersonate approver to validate
  9. Open exist form -> To open approval form using Approval ID from #7
  10. Set Variable Values -> You can select option to Approved.
  11. UI action/button -> Click Save button to save the form.

View solution in original post

10 REPLIES 10

Look like you doing it incorrect on step #5 by using sysapproval_approver table instead of sc_req_item table.

In step #5 you need to get RITM record first,

  1. Use table called sc_req_item.
  2. Use conditions: Request is request_id(From step #4). It will look like Step 4: Order Catalog Item > request

Here is screenshot example,

find_real_file.png

find_real_file.png

On step #7 is where you can get approval record from sysapproval_approver table by using RITM record from step #5. You need RITM# for conditions, Approval for is RITMXXXXXXXX(use step #5 RITM ID here). Don't use REQ#.

Then on step #7 is where you can get Approval record by using RITM# from step #5 to get approver approve.

Here is screenshot example(Ignore my step # because I have different steps. Use your step #5 to use RITM ID and step #7 to use Approval ID),

find_real_file.png

That helped. Thank you. But quick question though. On Step 6, how are you doing the record validation? Whatever I am doing is throwing an error, so everything but that step is working great for me.

Thanks, that worked.

I have 2 questions about Step 6 on Record Validation. Are you supposed to do that after opening a record or after Record Query? Because I am getting an error saying you didn't open any record so we can't validate it.

Also, to "to ensure that RITM exist and the stage is approval", how do I do that from the previous steps?

 

BTW, this is how my steps look like:

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item
  5. Record Query -> To get RITM record using Req ID from #4
  6. Record Query - > To get Approval(sys_approval) record using RITM ID from #5
  7. Impersonate -> impersonate approver to validate
  8. Open exist form -> To open approval form using Approval ID from #6
  9. UI action/button -> Click Save button to save the form.

 

Again, thanks for all the help.

It not necessary to do Record Validation after Record Query but it a good practice for validation and investigate purpose in case it get error.

To do that on Step #6 Record Validation,

  1. Table = Requested Item(sc_req_item)
  2. Record = Use Step #5 RITM ID
  3. Field Values/Conditions = Item is "Name of your catalog item that you just submitted"
  4. (optional) You can add another field but above is good enough.

 

There is alternative way to validate RITM form which I prefer this way because of screenshot,

  1. On Step #6, use Open an Existing Record step. Table is Requested Item and Record is Step #5 RITM ID
  2. Next step is Field Values Validation step. Item is "Name of your catalog item that you just submitted"

The difference between Record Validation and Field Values Validation,

  • Record Validation - Quicker test executing time, Use only 1 step, and no screenshot.
  • Field Values Validation - little more test executing time, use 2 steps(First, Open an Exisiting Record step and then Field Values Validation step), and it does screenshot.

I prefer second option because if there is any error in validation step, I can check the failed screenshot to find where exactly the error came from in the form.