Select to view content in your preferred language

Arcade expressions in body of email not working

973
4
Jump to solution
06-27-2022 01:25 AM
sirishb
Regular Contributor

Hi All,

ArcGIS enterprise version: 10.9.1

We are using ArcGIS Workflow Manager Server (service-driven) and we have created a simple workflow diagram to send email using "Send Email" step. Created Arcade expressions in 'Subject' and 'Body'.

WFM_Email.JPG

After completion of the job execution, we have received email as follows.

Gmail.JPG

 Same Arcade expression is working fine in 'subject' but not working in 'body' of the email.

 Appreciate any help. Thanks.

Regards,

Sirish

0 Kudos
1 Solution

Accepted Solutions
JFarmer
Esri Contributor

@Hi @sirishb 

Your issue is that you have text that is not encapsulated with single quotes. All text besides Arcade expressions has to be encapsulated in single quotes. I noticed it's missing at the beginning and end of your body text. See my example below.

JFarmer_0-1656515532294.pngJFarmer_1-1656515541168.png

 

View solution in original post

4 Replies
JFarmer
Esri Contributor

@Hi @sirishb 

Your issue is that you have text that is not encapsulated with single quotes. All text besides Arcade expressions has to be encapsulated in single quotes. I noticed it's missing at the beginning and end of your body text. See my example below.

JFarmer_0-1656515532294.pngJFarmer_1-1656515541168.png

 

sirishb
Regular Contributor

@JFarmer ....Thank you very much

0 Kudos
bbaker_tngeo
Regular Contributor

I'm also having a syntax issue with an email template. I saw the Environmental Review Workflow demo that @TiffanyWeintraub presented and liked how the link to the job was included in the email body. When I configure the text body and preview the email using a JobID, it looks good, but after I save it, the formatting is changed and the content no longer works. Does appending the jobID to a URL not work using Arcade?

Preview:

 

'<h3>A new project has been submitted for review.</h3>
Contact Name: ' + jobExtendedProperty($job, 'projectdetails', 'primarycontact') + 
'<br/>
Phone: ' + jobExtendedProperty($job, 'projectdetails', 'phone') +
'<br />Location: ' + jobExtendedProperty($job, 'projectdetails', 'address') +
'<br />Project details: ' + jobExtendedProperty($job, 'projectdetails', 'details') +
'<br /> Please visit <a href="https://orgportal/portal/apps/workflowmanager/workflowid/workq=' + jobName($job) +'">website</a> to review the project.'

 

 

bbaker_tngeo_0-1673279437554.png

 

Email (after saving):

 

'<h3>A new project has been submitted for review.</h3>
Contact Name: ' + jobExtendedProperty($job, 'projectdetails', 'primarycontact') + 
'<br/>
Phone: ' + jobExtendedProperty($job, 'projectdetails', 'phone') +
'<br />Location: ' + jobExtendedProperty($job, 'projectdetails', 'address') +
'<br />Project details: ' + jobExtendedProperty($job, 'projectdetails', 'details') +
'<br /> Please visit <a href="https://orgportal/portal/apps/workflowmanager/workflowid/workq='%20+%20jobName%28$job%29%20+'">website</a> to review the project.'

 

 bbaker_tngeo_1-1673279473743.png

0 Kudos
bbaker_tngeo
Regular Contributor

***Update***

I was able to create the desired URL with the jobName appended to the end of a text string. However, I did not use the <a></a> tags. Rather, I just constructed the URL using text and the jobName($job) dynamic job properties. Outlook will recognize the text as a hyperlink. The Email app on Android does not recognize the text as a clickable hyperlink, but it does on the mobile Outlook app. I don't have an Apple device to test, but depending on the use case, this might be sufficient for users.