Question
Store custom action response to a variable
Hey There!
I have a custom action which returns payload in the below format (as a contextual attribute)
{
"data": {
"products": {
"products": [
{
"productId": "111",
"title": "sample-title",
"url": "sample-url"
}
]
}
}
I can traverse through this object using each loop and access the inner objects like below
]
}
}
I can traverse through this object using each loop and access the inner objects like below
{{#each context.journey.actions.3826ab4b-218b-476a-829b-fc07fc7790d3-1753790791486-1.data.products.products as |product|}}
{% let id = product.productId %}
{{/each}}
However, when I try to store the contextual attribute to a variable, this error happens
{% let contextVar = context.journey.actions.3826ab4b-218b-476a-829b-fc07fc7790d3-1753790791486-1 %}
Error:
Error:
Invalid syntax Invalid syntax Error in parsing PQL expression "context.journey.actions.3826ab4b-218b-476a-829b-fc07fc7790d3-1753790791486-1": line 1:23 mismatched input '.3826' expecting {<EOF>, '*', '/', '%', '+', '-', '(', '.', '[', '>', '>=', '<', '<=', '!=', '?:', '=', And, Or, Occurs, In, Like, Matches, 'notIn'}. Error beginning at position: Line 36, Character 1
This happens even if I try to store a simple string value returned by custom action. Kindly let me know whether the variable should be defined differently or the contextual attributes can't be stored as of now. Thanks