Recherches récentes
Pas de recherche récente
ZIS flow working with multiple variables in a transform action
Publication le 27 nov. 2023
Hey all,
I've build a flow to update the phone identities of a user if specific custom fields have been changed.
What I did so far is, that I get the previous custom field value (e.g. +49 030123), it is the value of the variable: $.input.user_event.previous and with that I call the identities endpoint and find out the identityID to make an update with the current value ($.input.user_event.current).
That works very well so far with these expression:
"expr": '.identities[] | select(.value == "+49 030123") | .id | tostring',
Now I would like to use not the hardcoded number, rather the variable itself -> $.input.user_event.previous and my code looks like this:
"find_phone": {
"Type": "Action",
"ActionName": "zis:common:transform:Jq",
"Parameters": {
"data.$": "$.identities",
"expr": '.identities[] | select(.value == "{{$.input.user_event.previous}}") | .id | tostring',
},
"ResultPath": "$.identity",
"Next": "Ok"
},
But it doesn't work, it seems that the previous variable is blank. It works only with a hardcoded value. So it seems that it is not possible to access to the input variable because the expression is within the data parameter $.identity (which is the API output of all identities of an user).
I am totally confused because if I use just a message to log it, works. My code looks like this:
0
3 commentaire
Nawed Farooque
Ok it works with passing data before.
0
Nawed Farooque
Hey Greg!
I tried it in this way:
"expr": ".identities[] | select(.value == {{$.input.user_event.previous}}) | .id | tostring"
Action Error: zis:common:transform:Jq ActionState(find_phone) Error: Encountered parsing error: error parsing jq output: unexpected token "{"
And in this way:
"expr": ".identities[] | select(.value == '{{$.input.user_event.previous}}') | .id | tostring"
ActionState(find_phone) Error: Encountered parsing error: error parsing jq output: unexpected token "'"
0
Greg Katechis
Hi Nawed! I haven't had a lot of time to play around with ZIS, however, I'm wondering if the issue has to do with the single quotes that you use in the "expr":key. Could you switch that to double quotes and then remove the trailing comma if it's the last parameter in that object and let me know if that resolves it?
0
Vous connecter pour laisser un commentaire.