- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:19 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:23 AM
Hi,
Here's how you can achieve this:
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.
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:23 AM
Hi,
Here's how you can achieve this:
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.
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:46 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:25 AM
Hi @chetanka ,
You can checkout this doc : https://docs.servicenow.com/bundle/utah-application-development/page/administer/auto-test-framework/...