Return HTML with Arcade in Pop-Up

1418
3
Jump to solution
05-01-2023 08:05 AM
usace_sam_rd3
Emerging Contributor

I have an arcade attribute expression that generates html.  I think I'm returning everything in the appropriate format, but my html is not getting interpreted.  What did I miss?

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Instead of using single quotes, use the back ticks. This is the template literal which allows you to use the "${}" placeholders.

return {
  type : "text",
  text : `<p>${fact_report}<br><a href="${fact_url}">Click to learn more</a></p>`
}

 

View solution in original post

3 Replies
KenBuja
MVP Esteemed Contributor

Instead of using that script in your Text element, you'll have to use an Arcade element to properly render that clickable link. You'll have everything above that in your Text element, the Arcade element for the link, then another Text element for the "Record last processed" information.

0 Kudos
usace_sam_rd3
Emerging Contributor

Ahhh!  I didn't even see that as an option!  However, I can't seem to get the variables returned.

fact_report & fact_url are variables upstream.  Is something missing in the return syntax?

return {

  type : "text",
  text : '<p>${fact_report}<br><a href="${fact_url}">Click to learn more</a></p>'
}
 
0 Kudos
KenBuja
MVP Esteemed Contributor

Instead of using single quotes, use the back ticks. This is the template literal which allows you to use the "${}" placeholders.

return {
  type : "text",
  text : `<p>${fact_report}<br><a href="${fact_url}">Click to learn more</a></p>`
}