ZIS flow working with multiple variables in a transform action



Publicado 27 de nov. de 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:

"Ok": {
"Type": "Succeed",
"Message": "Phone need to be change. ID: {{$.identity}} Value: {{$.input.user_event.previous}}"
}
 
Does the transform action need the input variable as a second parameter to access to it? How can I handle it?
 
Thanks in advance

0

3

0 comentários

Entrar para comentar.

Não encontrou o que estava procurando?

Nova publicação