HTML email Body

Hello,

I have below html script in the email body template in a google doc. But it does not show a button rather it shows the code.

Help me to correct the code.

In order to approve, please click the Approve button below. And also please whether the image source url is also correct?

<<HYPERLINK(CONCATENATE('https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=',[NFA Request No.],'&Option=Approve','> <img src="https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-" width="200">โ€™))>>

Please note that I am using email body template for sending workflow mail.

Thanks.

0 23 873
23 REPLIES 23

It still gives error as below. Captured from the log. I tried copying the raw as well as inserting image into the email body template.

"Errors": "Error: Workflow rule 'Send 1st Email' action 'Task Send 1st Email' Body template. Expression 'HYPERLINK(CONCATENATE('https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=',[NFA Request No.],'&Option=Approve','><img src=\"https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-\" width=\"200\">โ€™))' is invalid due to: HYPERLINK has invalid inputs.",

Steve
Participant V

Everything in the HYPERLINK(...) expression is wrong.

Can you please guide me to correct it? I donโ€™t know HTML and how to mention in the email body template. I have been trying since last few days but unsuccessful. Basically my need is to give two buttons in the email to the users to Approve or Not Approve a workflow. For which I have written a script (as per " Executing a DeepLink action from an Email Silently" and trying to call thru the button.

But unable to reach first step of providing button in the email.

I doubt this will work, but it should at least fix the error:

<<HYPERLINK("https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=" & ENCODEURL([NFA Request No.]) & "&Option=Approve")>><img src="https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-" width="200">

Thanks. Let me try this one and give you feedback.

You said doubt about the method, can you suggest the solution for this entire functioanlity?

Regards,

I cannot. Iโ€™ve never attempted to do such a thing. @LeventKโ€™s post is the best resource Iโ€™m aware of. Unfortunately, he is no longer a regular contributor to the community, so we canโ€™t ask him for help.

I copied as per your suggestion as below in the email body template in google doc, but still gives the error.

<<HYPERLINK("https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=" & ENCODEURL([NFA Request No.]) & "&Option=Approve")>><img src="https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-" width="200">

"Errors": "Error: Workflow rule 'Send 1st Email' action 'Task Send 1st Email' Body template. Expression 'HYPERLINK(\"https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=\" & ENCODEURL([NFA Request No.]) & \"&Option=Approve\")' is invalid due to: HYPERLINK has invalid inputs.",

Ah, the clickable text is required. Try this:

<<HYPERLINK(("https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=" & ENCODEURL([NFA Request No.]) & "&Option=Approve"), "<img src='https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-' width=200>")>>

See also:

Hello,

The output came like below screenshot.

Okay, thatโ€™s not entirely surprising. Does the link work, at least?

Yes, it at least sent the email. But the clickable button did not appear.

Try this instead of what we tried above:

<a href="https://script.google.com/macros/s/AKfycbyYZb6AEV3vf4zKJNrsVxq7vj-Aeqw3mLT_n3vf-gf-2cgEp2E/exec?ID=<<ENCODEURL([NFA Request No.])>>&Option=Approve"><img src="https://drive.google.com/uc?export=view&id=1A46QtbEPdQXS2qH65Gslzbf0tJ6GAv0-" width="200"></a>

No luck.

What I just posted should entirely replace the <<HYPERLINK(...)>> stuff. Did you do that? Perhaps post a screenshot of your template?

Yes, I replaced. Below is screenshot of the template.

3X_3_6_36696dc636339be684ff342b4cc33c4b2b17a6f9.png

If you omit the < a href=...>...</a> wrapper and include only the <img src=...> tag, does the image display in the generated report?

This looks like you were trying to add html code inside a GDocs, which doesn't make sense unless GDocs has some kind of HTML support

Just to inform, that I tried running the API script from an HTML editor to change value of a column, it worked. However, it did not trigger the workflow in the App to take next steps or trigger another workflow email.

I think that can be handled using Automation (Bot).

But, the first point has to be solved to show buttons in the email.

Thanks.

Nope. See below. Alternatively, can we have two links, one for clicking Approve and another for clicking Not Approve.

Not with below also.

Iโ€™m out of ideas, then. Please contact support@appsheet.com for help with this.

@Steve

Hello, I tried with the solution suggested by @LeventK. I developed Apps Script as per his post which is working fine and also executes subsequent actions and workflows and sends mails.

Now, I changed to go with only hyper link instead of button in the email body. That coding also I did.

The issue here is that on clicking the โ€œApproveโ€ link, it seems that it is not calling / reaching / executing Apps Script.

When I run Apps Script form the script editor, it works fine.

What could be the issue?

I have no experience using Google App Script, so I have no guidance to offer there.

Top Labels in this Space