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 343
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