How do I set a variable value on the catalog task interface using ATF?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2020 01:48 PM
Hi all,
I am creating an end to end ATF test case where the user is submitting a laptop request, the request gets approved and fulfilled.
We have a test step in the middle of the fulfillment process where the fulfillment team enters the serial number of the laptop in the variable editor field of the Catalog task. I am looking for help on automating this step.
Somehow, the Custom UI step is not able to pull all the elements of this page.
Thanks,
Ravish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:28 PM
Hi Ravish,
Do you mind sharing how you were able to update these variables through a server script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 09:28 AM - edited 10-13-2022 09:32 AM
below is the code that i am using for a new ATF step that i am writing. this is because of 2 reasons. these variables are dropdown variables and their dropdown values are generated through an on load script when the page loads and hence it is not possible to set their value through regular means in ATF and also the 'set variable value' is not working as intended
(function(outputs, steps, params, stepResult, assertEqual) {
var ritm_object = new GlideRecord("sc_req_item");
ritm_object.addEncodedQuery("sys_created_onONLast 15 minutes@javascript:gs.beginningOfLast15Minutes()@javascript:gs.endOfLast15Minutes()^cat_item=" + gs.getProperty('CATALOG.SYS.ID') + "^task_for=" + params.u_requester);
ritm_object.orderByDesc('sys_created_on');
ritm_object.query();
if (ritm_object.next()) {
ritm_object.variables.architect = params.architect ;
ritm_object.variables.delivery_lead= params.delivery_lead;
ritm_object.update();
}
})(outputs, steps, params, stepResult, assertEqual);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2020 07:19 AM
Hope you are doing good.
Did you get a chance to check on the solution provided to resolve your query?
If your query is resolved please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader