- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 06:45 AM
Apparently, I'm struggling with something that should be very simple, so looking for help here.
The short version is that when using var prevStep = steps('SYS_ID_PREV_STEP'); I'm getting no results. i've tried with .record_id, without it, etc.
For the purposes of debugging this, I made a new test in my PDI. Step 1 is to impersonate a user. Step 2 is the server script. steps('step1_sys_id'); should return the sys_id of the user in the impersonate step. At least that's my understanding.
To get the sys_id of the previous step, I opened the record, went to the context menu and copied the sys_id. I've also tried it by going to the sys_atf_step table and copying it that way.
In both cases, if I set the stepResult.setOutputMessage('step 1 record syd_id = ' steps('Step1sys_id')'); I get null output. If I specify .record_id at the end, I get undefined.
In the real case, what I'm trying to do is get the sys_id of a ritm, so I can parse the sc_item_option table to query and set variable answers on SCTask records, so considerably more complex than the above, but I already have that working in a background script, so my code there is ready to go... I just can't make this ATF server script behave.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2019 08:10 PM
Hi Adam
Short answer, please use steps('Step1sys_id').user.
Long answer with the explanation
The step's sysID is indeed needed to be copied from sys_atf_step table corresponding to your desired record (e.g.: sys_id of Step 1 for impersonation here).
There could be more than one output variables for a given Step. Hence you need to use the correct output variable in the subsequent steps. e.g. for impersonation Step it would be
steps(stepSysID).user
and for Record Query, it would be
steps(stepSysID).record_id
The exact name of the output variables can be seen in the respective 'Step Configuration' table, e.g.: for impersonation step, please go to the section/tab 'Output Variables' under: <instanceURL>/sys_atf_step_config.do?sys_id=071ee5b253331200040729cac2dc348d
--
Best regards
Ankush
P.S. Please mark helpful/correct as appropriate to help fellow Community user in identifying useful answers.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2019 08:10 PM
Hi Adam
Short answer, please use steps('Step1sys_id').user.
Long answer with the explanation
The step's sysID is indeed needed to be copied from sys_atf_step table corresponding to your desired record (e.g.: sys_id of Step 1 for impersonation here).
There could be more than one output variables for a given Step. Hence you need to use the correct output variable in the subsequent steps. e.g. for impersonation Step it would be
steps(stepSysID).user
and for Record Query, it would be
steps(stepSysID).record_id
The exact name of the output variables can be seen in the respective 'Step Configuration' table, e.g.: for impersonation step, please go to the section/tab 'Output Variables' under: <instanceURL>/sys_atf_step_config.do?sys_id=071ee5b253331200040729cac2dc348d
--
Best regards
Ankush
P.S. Please mark helpful/correct as appropriate to help fellow Community user in identifying useful answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2019 08:24 PM
Thanks Ankush. That lead me to the right answer. The record query step needs first_record as its argument.