I have configured the following worflow, which is intended to send a GET rest call, obtain and manipulate some data and send it via email. I am having problem when trying to catch HTTP Request body. If I use variable $.hTTPRequest.body on email, I am receiving entire body (ok). But when I define a variable with $.hTTPRequest.body as value, it sends email empty.
Notice that variable “body” points directly to $.hTTPRequest.body, and “var” points to $.defineVariable.body2, and both variables are supposed to return the same (that is, the response).
A little update. I put a Wait action between HTTP Request and Define Variable, and still does not work. Also, tested Define Variable with some attribute of the Identity Created trigger and works fine. I am thinking that the Define Variable operator can not initiate a variable with the HTTP Request output (body).
Hi, I performed a simple test and see that with any output from previous actions, the define variable works fine, but when I test the HTTP Request output, it does not:
The Define Variable operator allows to create more more dynamic attributes/text values in the workflow by applying transforms to static text/attribute. In this case as there is no transform I think the value is coming in as null/blank. I believe the transform is necessary, it doesn’t work like a SET operator.
Is there any specific reason why you are trying to set the define variable to $.hTTPRequest.body instead of using that directly in email body as $.hTTPRequest.body ?
I tried concatenating a fixed string, and result is the same string, really it does not work for $.hTTPRequest.body, neither $.hTTPRequest.headers or $.hTTPRequest.statusCode. Tried other action outputs and works fine.
I am needing this, because I have a scenario where an identity is created, it generates the email and a workflow should return this email to HR system.
Problem is that it is done in 2 steps. First one is calling a GET method, then I have to copy/paste the returned json payload into a PUT body, and adding the email attribute to this payload.
That is why I tried to define a variable in which it contains the output of the first HTTP Request calling the GET method, and then replace “}” with " ,‘email’=‘xxxxx’} " (and use it on the second HTTP Request)
According to the docs for define variable, the output type for all variables using this operator is string.
All variable output types are string unless the last applied operation is Get Index. If Get Index is the last operation, the output type is an integer.
$.hTTPRequest.body is likely either an array or an object, in which case the output will be null because it’s not a string. This is the expected behavior for now.
Per Sharvari’s point, skip the define variable and just use JSONpath to reference $.hTTPRequest.body directly in the email template.