How to create a custom output variable for ATF Run Server Side Script?

Lance_
Giga Contributor

I need to create an ATF Run Server Side Script Step that outputs more than 80 characters.  How do I create the custom output variable?

1 ACCEPTED SOLUTION

Hi Lance,

the Run Server Side script is out of the box test step; please avoid changing anything to it;

you can create your own custom step which would be server side; define as many input variables and output variables

What is your exact requirement? Are you saying you want custom step script to query some table and store some text which is more than 32 characters and you want to use that in the next step

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

Not sure what you mean, but we can create or use output of that run script activity in our activities.

Example:
//
// // Test step 1 - add data
// var gr = new GlideRecord('sc_task');
// // this sample step's Step config has Output variables named table and record_id
// outputs.table = 'sc_task';
// outputs.record_id = gr.insert();
//
// // Test step 2 - access added data and validate
// // check that the record exists (or that business logic changed it)
// var gr = new GlideRecord("sc_task");
// gr.get(steps(PREVIOUS_STEP_SYS_ID).record_id);
// assertEqual({name: "task gr exists", shouldbe: true, value: gr.isValidRecord()});
//

 

Thanks,
Ashutosh

Lance_
Giga Contributor

record_id has a 32 character limit and table has an 80 character limit.  I need to output more data than that.  I have seen where custom output variables are possible but I cannot figure out how.  

 

Hi,

Yes what i will suggest is to put the stepResultOutput and then access that in your code by querying that stepResultOutput.

// stepResult.setOutputMessage: Log a message to step results after step executes.
// Can only be called once or will overwrite previous
// message
//

 

Thanks,
Ashutosh

Hi Lance,

the Run Server Side script is out of the box test step; please avoid changing anything to it;

you can create your own custom step which would be server side; define as many input variables and output variables

What is your exact requirement? Are you saying you want custom step script to query some table and store some text which is more than 32 characters and you want to use that in the next step

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader