asgallant
asgallant

Reputation: 26340

Is there a way to access logic app parameter inside a custom javascript action?

I have a logic app that is using a custom javascript action. How can I access a logic app parameter from within the javascript code?

I have defined a BatchSize parameter:

"parameters": {
  // lots of stuff
  "BatchSize": {
    "type": "int"
  }
}

and the custom javascript action:

const data = workflowContext.actions.API_A_ACTION.outputs.body;
const dataLength = data.length;
const batchedData = [];
const batchSize = 1000; // this is what I would like to set from the BatchSize parameter

for (let i = 0; i < dataLength; i += batchSize) {
    const batch = data.slice(i, i + batchSize);
    batchedData.push(batch);
}

return batchedData;

Is there a way to access the parameters? The logic app documentation only mentions referencing triggers and actions.

Upvotes: 1

Views: 1448

Answers (2)

paul34
paul34

Reputation: 1

workflowContext.actions.Initialize_variable_pageSize.inputs.variables[0].value

Upvotes: 0

Derek Li
Derek Li

Reputation: 3111

Not directly but you can add a compose action with the workflow parameter as input, and reference the output of compose in inline code.

Upvotes: 3

Related Questions