The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to get incident number from Inbound REST API transaction using ATF

chetanka
Tera Contributor

Hi... I am creating an incident using Inbound REST api and for this a transaction got created in transaction table(Custom table). I want to retrieve Incident number from the Transaction table to verify the fields. Can we achieve this using ATF?? If Yes Please let me know how to retrieve it.

TIA.

Regards,

Chetan

1 ACCEPTED SOLUTION

-Andrew-
Kilo Sage

Hi,

 

Here's how you can achieve this:

  1. After the incident and transaction are created, you can retrieve the incident number using a GlideRecord query in a test step

var gr = new GlideRecord('custom_transaction_table');
gr.addQuery('sys_id', 'transaction_sys_id');
gr.query();
if (gr.next()) {
    var incidentNumber = gr.incident_number;
}

In this example, 'custom_transaction_table' is the name of your custom transaction table, 'transaction_sys_id' is the sys_id of the transaction record you want to retrieve the incident number from, and 'incident_number' is the name of the incident number field in the Transaction table.

 

  1. Verify the incident fields: After retrieving the incident number, you can use a GlideRecord query to retrieve the incident record and verify its fields in another test step.

By following these steps, you can retrieve the incident number from the Transaction table and verify its fields using ATF

View solution in original post

3 REPLIES 3

-Andrew-
Kilo Sage

Hi,

 

Here's how you can achieve this:

  1. After the incident and transaction are created, you can retrieve the incident number using a GlideRecord query in a test step

var gr = new GlideRecord('custom_transaction_table');
gr.addQuery('sys_id', 'transaction_sys_id');
gr.query();
if (gr.next()) {
    var incidentNumber = gr.incident_number;
}

In this example, 'custom_transaction_table' is the name of your custom transaction table, 'transaction_sys_id' is the sys_id of the transaction record you want to retrieve the incident number from, and 'incident_number' is the name of the incident number field in the Transaction table.

 

  1. Verify the incident fields: After retrieving the incident number, you can use a GlideRecord query to retrieve the incident record and verify its fields in another test step.

By following these steps, you can retrieve the incident number from the Transaction table and verify its fields using ATF

Hi Thank you for the reply, I have another query..

I have done a inbound transaction and transaction got created in Custom table with a ttransaction number in response body, How to fetch tat transaction number from response body so that I can use it in my further steps.

 

Community Alums
Not applicable