ceast3
ceast3

Reputation: 1

Coverting plain text to dynamic content within an action in power automate

I am generating emails in power automate using the HTML body of an email template in salesforce.

beginning of flow - query salesforce for campaign members and email templates

I want to use the HTML content from the salesforce email templates, and replace the automated salesforce fields with the corresponding Dynamic Content field from the "Campaign member" step @{items('Apply_to_each')?['CompanyOrAccount']} and @{items('Apply_to_each')?['FirstName']}

for example:

    <br>
    <html>
      <head>
        <title></title>
      </head>
      <body style=\"height: auto; min-height: auto;\">
        <span style=\"font-size:12px;\">
          <span style=\"font-family:Arial,Helvetica,sans-serif;\">Hi&nbsp;@{items('Apply_to_each')?['FirstName']},</span>
        </span>
        <br />
        <br />
        <span style=\"font-size:12px;\">
          <span style=\"font-family:Arial,Helvetica,sans-serif;\">Is power automate holding @{items('Apply_to_each')?['CompanyOrAccount']} back? <br />

You can see the variables for dynamic content

@{items('Apply_to_each')?['FirstName']}

@{items('Apply_to_each')?['CompanyOrAccount']}

Since the HTML is inserted as a variable, power automate does not pull the values for the variables. it displays them as plain text in the email body.

I tried replacing the salesforce variables with the values @{items('Apply_to_each')?['CompanyOrAccount']} and @{items('Apply_to_each')?['FirstName']}, but what resulted was an email that says:

Hi @{items('Apply_to_each')?['FirstName']},

Is power automate holding @{items('Apply_to_each')?['CompanyOrAccount']} back?

Upvotes: 0

Views: 674

Answers (1)

jleture
jleture

Reputation: 1068

You must add the expression in the body email with your Apply to each on the Expression and not Dynamic content. If not, the expression will be displayed as text!

items('Apply_to_each')?['FirstName']

expression

But it's unclear what you are trying to do.

Please edit your question and add more details.

Upvotes: 1

Related Questions