Set API variable for "RUNASUSEREMAIL" to "USEREMAIL()"

Hi,

I am using the api to copy child rows of data, however, at the moment the app runs with the RUNASUSEREMAIL variable set to me. I would like to change it to the user who activates the workflow. How can I used the USEREMAIL() function in the API? What I have shown below doesn’t work.

{
“Action”: “Add”,
“Properties”: {
“Locale”: “en-GB”,
“Location”: “47.623098, -122.330184”,
“Timezone”: “Pacific Standard Time”,
“RunAsUserEmail”: "USEREMAIL()"
},

0 7 339
7 REPLIES 7

This looks correct per the support doc. What do you mean it doesn’t work?

Are there any errors in the logs?

What is your end-goal?

What do you want to do with USEREMAIL() in the next step of the workflow?

In the data instead of seeing the users’ email address… it shows USEREMAIL() as text. I would like to show the user’s email address.

This means in the table that is being copied, I have a field “Author” that is populated with their USEREMAIL when they initially fill out the record… however when using the API, previously it was putting in my email address. When the API is triggered, I want it to add the new records as the user’s email address, however with the script above, it puts in “USEREMAIL()” into the Author field.

Oh, I see what the problem is. In your template, you need to use angle brackets around the code.

"RunAsUserEmail”: “<<USEREMAIL()>>”

It was just passing the string ‘USEREMAIL()’.

I will give this a try. Thanks @GreenFlux.

I m not sure but why dont you push useremail()) witin the api request body in JSON ?

Hi @tsuji_koichi, I did put that in the json code, however the variable USEREMAIL() was not recognised. It recorded “USEREMAIL()” in the datasource, instead of the users’ email address.

Actually what I wanted to suggest was the exactly same as @GreenFlux suggested to you. I reckon it should work and follow his instructions.

Top Labels in this Space