How to embed HTML in an expression rule

Certified Associate Developer

Hi all ,

I have to generate a table with the help of html . Is there any way to create . Please let me know know the ways

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to saurabh sharma

    Hi Saurabh, 

    if your requirement is to send the request body in HTML text with only 3 columns and your current expression rule also provides the HTML table.

    Here's a code snippet where you can remove some un-necessary variables, hope it helps.

    a!localVariables(
      local!data: {
        {
          date: today(),
          link: {
            href: "https://www.google.com",
            value: "Google"
          }
        },
        {
          date: today() - 4,
          link: {
            href: "https://community.appian.com",
            value: "Community"
          }
        },
        {
          date: today() + 3,
          link: { href: "", value: "Appian" }
        }
      },
      joinarray(
        {
          "<table>",
          "<tr><th>S.No.</th><th>Date</th><th>Links</th></tr>",
          a!forEach(
            items: local!data,
            expression: concat(
              "<tr>",
              "<td>" & fv!index & "</td>",
              "<td>" & text(fv!item.date, "mmm dd yyyy") & "</td>",
              "<td> 
              <a href='" & a!defaultValue(fv!item.link.href, "#") & "'>" & fv!item.link.value & "</a>",
              "</td>",
              "</tr>"
            )
          ),
          "</table>"
        },
        char(10)
      )
    )

    The above code displays as below on a browser

  • 0
    Certified Associate Developer
    in reply to agam

    Hi agam , thanks for replying will this grid will work in Google chat . Means I have to send a message in Google chat

  • 0
    Certified Lead Developer
    in reply to saurabh sharma

    Hi Saurabh,

    It depends on how the Google API is expecting the request format to be

    You can try / check in their documentation