how to access the input variables of a Reusable Test from a Run Server-Side Script step
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 06:50 AM
how to access the input variables of a Reusable Test from a Run Server-Side Script step within the same reusable test. I have tried with param and steps
java.lang.IllegalArgumentException: Step id 23cb768dc335e61043d59e377d0131af is not valid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 06:54 AM
@JithinK Can you try with this
steps.getInputValue('my_input_variable_name');
Please mark correct/helpful if this helps you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 07:06 AM
I have tired this, I hope 'my_input_variable_name' basically the column name of the input. But getting output undefined
output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 05:57 AM - edited ‎07-21-2025 06:17 AM
Hi - I used the following approach to pass Reusable Test input values to a script:
Instead of using the "Server Side Script" Step - I created a Custom Step configuration that can run a script. ( https://www.servicenow.com/docs/bundle/yokohama-application-development/page/administer/auto-test-fr... )
So first,
- I created a new Step Config (Script / Server) .
- I added script, input & output variables specific for the use case.
- Then, when creating the test, I add a new test step based on the Step Config and pass the reusable inputs to the Script Step via a pill.
It is also possible the create a generic Step Config with a script input parameter that allows the script to be defined within the Test Step itself - by using a script input parameter (similar to the current Run Server Side Script step). Then the Step Config Script will call JavaScript 'eval' on the parameter. However, I think this approach should be avoided, and all of the script logic kept inside the Step Config. Then just create a dedicated Step Config for each use case.