Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Accessing Data pill variables from Script parser Script

JPing
Tera Expert

Hello, 

 

I have created a Data Stream Action. I set a variable in Pagination Setup Step, I then use this in construction of the Rest Step. It works perfectly. I am able to drag the pill into the Resource path. 

 

I would like to use this same variable in the Script Parser Step, how do I access this variable?

 

Here is the Script parser Script 

(function parse(inputs, outputs) {

    var item = JSON.parse(inputs.sourceItem);
    outputs.targetObject.name = item[0];
    outputs.targetObject.email = item[1];
    outputs.targetObject.query = <varaible set in the pagination step>;
}

 

My Pagination step does not paginate on pages but rather on an array of queries. For each query a set of data is returned. As I parse through each row and I want to add the query that was used to the import set table. To solve this all I need to do is access the variable I set in the pagination step. 

 

Thanks in advance.  

10 REPLIES 10

Gabriel Moreir2
Tera Contributor

Hi @JPing , did you find a way?

So in the parse script instead of using "fd_data" use "inputs.fd_data"

 

 

Example: 

inputs.fd_data.action_inputs.<input variable>
inputs.fd_data._4__pagination_setup_step.pagination_variable_map.<pagination variable>
 
apparently fd_data is a property of inputs and not globally accessible in the parse script. 
 
Don't know why

I see that now in Vancouver the autocompletion is working properly and it will provide the available variables. I don't think this was available back when this thread started right?

GabrielMoreir2_0-1707760549515.png

 

What version of SN are you on for this to work?