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

Hi Scott, I believe that screenshot was from Vancouver

Jacob26
Tera Guru

Wondering if you found a solution to this.

 

I have a similar requirement. Exactly like your scenario, except I have a need to access an input variable in the script parser step. My REST call returns rows of data from a report, but lacks the column headers, so I also need the column headers array from my input variable to build the output object. I tried using fd_data but I get an error that fd_data is undefined.

Hi @Jacob26, yes JPing highlighted that variables are made available under inputs.fd_data...

Hi @Gabriel Moreir2, even though these variables appear accessible in the script editor, upon testing the action, these variables are undefined at runtime. The only thing that appears to be accessible at runtime is inputs.fd_data.action_inputs. Not sure why they'd make these appear available if they're really not, but it seems that's the current behavior unfortunately.

 

I was actually able to solve my use case using a dynamic object in the output. Since the action to determine the schema runs first, I was able to pull the list of columns from the schema object in my pre-execution script step. This probably won't work for everyone's use case, but it solved mine.

 

Thanks for the comments and feedback thought! Still wishing there was a way to access the full request body from the script parser step, I think it would make everyone's lives a little easier.

Service_RNow
Mega Sage

Hi @JPing 

Please follow this Doc you will find some interesting info regarding..

Data Stream Actions 

 

Please mark reply as Helpful/Correct, if applicable. Thanks!