Sending a copy of results with HTML

Hi!
I’ve been working recently on a form that allows user to request a budget based on their choices. When submitting, it both displays the results on screen and sends the user a copy of them. I know it’s possible to use the contact object’s properties in the email, but the budget result is showed to the user as a table, too complex to only add it as plain text.
I’ve tested two ways to solve this:
Option 1: Rich text

It would work wonderfully but rich text properties can’t be used on forms, and I’m very doubtful the table could be inserted in any other way that’s not direct copy and paste of the selection on the results.

Option 2: Stringified JSON and module

It worked partially. It works by converting the table contents into JSON and sending it along the form. To send the email, a custom coded module should be used to extract the JSON string from the contact property and render it again as a table with HubL.
I’m stuck when trying to use it on the email. Using it as a CRM object field returned me an error on the email editor:

And trying to use the crm_object function inside the module itself returned me a warn: “CONTACT objects can only be retrieved on membership or password-restricted pages”. (Although I’m not really sure if this method could work at all, since the ID should be binded to the contact in each instance of the email.
I’d be thankful if anyone could help me with the latter option, as I see it the most viable, but if any has another option/workaround, it’s welcomed too!

Hey @dcancho, thank you for posting.

For sending a table-based result via email, your JSON and module method is a good approach, though HubL’s email limitations make it tricky. One workaround is to create a pre-generated HTML table and save it as a single-line text property on the contact record. This way, the HTML can be directly embedded in the email without needing complex JSON parsing. Alternatively, linking to a personalized landing page with the table formatted might also achieve the effect you need.

To our top experts, @Anton and @DanielSanchez do you have any recommendations for @dcancho matter?

Thank you,

Pam

Thank you, @PamCotton!
Yes, I think it’s the best approach until there is a more structured and straightforward one. The landing page option seems interesting too; I guess using dynamic pages and HubDB (to allow multiple submissions of the form from the same user be rendered without overwriting properties) could be the way to go.

I followed the process explained at this other post, using two properties and a workflow, to be able to upload the HTML content through the API. Added the link there for anyone with this same question.