Scripting in ATF: Calling a decision table with earlier step input and use the output for next step
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 08:05 AM
Hi all,
I am building an ATF for a service catalog item. There is an approval step that comes from the decision table.
I want to automate that step.
I create a Run Server Script step to call the result of the decision table.
(function(outputs, steps, params, stepResult, assertEqual) {
// add test script here
try {
var inputs = {};
inputs['u_location'] = steps('f0b51ea3c350265050fb5933e4013113').location_of_requester; // Choice, Mandatory
var dt = new sn_dt.DecisionTableAPI();
var response = dt.getDecision('55326778c30a8e143fb9522bb001314f', inputs);
var result_elements = response.result_elements;
var u_pp = result_elements.u_pp.getValue(); // Reference
var u_pp_backup = result_elements.u_pp_backup.getValue(); // Reference
var u_npp_not_belgium = result_elements.u_npp_not_belgium.getValue(); // Reference
var u_npp_not_belgium_backup = result_elements.u_npp_not_belgium_backup.getValue(); // Reference
outputs.user_id = u_npp_not_belgium;
} catch (e) {
gs.log("Couldn't run this script Error: " + e)
}
})(outputs, steps, params, stepResult, assertEqual);
--
inputs['u_location'] = steps('556bcc4cc37f9a503fb9522bb001311f').location_of_requester;
with this line, I tried to get the input of another step in my ATF (with that sys), which was "Set Variable Values" step.
When I ran this test, I receive the following error:
Cannot read property "result_elements" from null
The second issue is that:
After the Run Server Side Script, I have the impersonation step where I try to get the output of the script. However, when I try to find that output in Impersonation step, I only have the following:
Any idea how to fix this?
Best,
Firat
0 REPLIES 0