I try to use HTML in the Workflow Email Body. The result looks like that:
I have 2 questions:
Even though I set the font to Arial, why does the Table have another font?
How do I get the <<Start>> <<End>> expression to work, so that it does new lines for every new record?
My HTML Code is:
<font face="Arial"><h1>Bestellung</h1><font face="Arial"><table border="1" style="width: 100%; border-collapse: collapse; float: left; border-style: solid;"><tr><td style="width: 15.4087%; background-color: #0069b3;"><span style="color: #ffffff;">Mitarbeiter:</span></td><td style="width: 84.5913%;"><<MitarbeiterVC>></td></tr><tr><td style="width: 15.4087%; background-color: #0069b3;"><span style="color: #ffffff;">Kommission:</span></td><td style="width: 84.5913%;"><<Kommission>></td></tr><tr><td style="width: 15.4087%; background-color: #0069b3;"><span style="color: #ffffff;">Bemerkung:</span></td><td style="width: 84.5913%;"><<Bemerkung>></td></tr></table></font>
<table border="1" style="width: 100%; border-collapse: collapse; float: left; border-style: solid;"><tbody><tr><td style="width: 20%; background-color: #0069b3;"><strong><span style="color: #ffffff;">Händler</span></strong></td><td style="width: 20%; background-color: #0069b3;"><strong><span style="color: #ffffff;">Artikelnummer</span></strong></td><td style="width: 20%; background-color: #0069b3;"><strong><span style="color: #ffffff;">Artikel</span></strong></td><td style="width: 20%; background-color: #0069b3;"><strong><span style="color: #ffffff;">Anzahl</span></strong></td><td style="width: 20%; background-color: #0069b3;"><strong><span style="color: #ffffff;">Bemerkung</span></strong></td></tr><tr><td style="width: 20%;"><<Start:ORDERBY([Related Bestellungs] , [Händler])>><<Händler>></td><td style="width: 20%;"><<ArtikelNr.>></td><td style="width: 20%;"><<Artikel>></td><td style="width: 20%;"><<Anzahl>></td><td style="width: 20%;"><<Bemerkung>><br><<IFS([Lagerfach] = "Ja" , "Lagerfach anlegen!")>><<End>></td></tr></tbody></table>
<a href='<<CONCATENATE('https://www.appsheet.com/start/893a9bce-fd34-4ecb-a9bb-1d7cc344ae2b#appName=Inventur-38452&page=detail&row=',[Key],'&table=Kommission&view=Kommission_Detail')>>' target='_blank' rel='noopener' title='Bestellung öffnen'><img src="https://imgplaceholder.com/300x50/0069b3/ffffff?text=Bestellung+%C3%B6ffnen&font-size=30" alt="Bestellung öffnen" width="300" height="50" caption="false" style="float: left;" /></a>
<a href='<<CONCATENATE('https://script.google.com/a/walk-korntal.de/macros/s/AKfycbzGWNp2f4rC2lyQc2sfjnwTdlJFmNAZRFZcL6w/exec?ID=',[Key],'&Option=erledigt')>>' target="_blank" rel="noopener" title="Bestellung erledigt"><img src="https://imgplaceholder.com/300x50/008F33/ffffff?text=Bestellung+erledigt&font-size=30" alt="Bestellung erledigt" width="300" height="50" caption="false" style="float: left;" /></a></font>
1 Like
Phil
August 5, 2019, 5:26pm
3
I can investigate if you provide:
Your account id
The app nme
The workflow rule name
The steps to reproduce the problem
Thank you @Phil for investigating.
Account ID: 651676
appName=Inventur-38452-651676
Rule Name: Bestellung Parent
Please have a look in the Email Body
Phil
August 5, 2019, 7:24pm
5
Hi Fabian,
Your template is not being treated as HTML because it does not start with one of the following values:
<Body <Head or <Html
Make one of these three HTML elements the first thing in your template, and add the matching closing HTML tag at the end of the template.
In an HTML file the value << must be HTML encoded as <<
The value >> must be HTML encoded as >>
There appear to be other problems in your template also because it fails HTML parsing.
You might be better off using a Google Doc template.
Thank you Phil for those points. I will give it another try. My goal is to get a clickable button in the Email Body. This is not possible with a Google Doc Template AFAIK.
What do you mean by this?
Phil:
In an HTML file the value << must be HTML encoded as <<> The value >> must be HTML encoded as >>
Phil
August 5, 2019, 9:01pm
7
Sorry about that.
<< characters must be encoded as an <<
>> characters must be encoded as an >>
1 Like
@LeventK Do you have any simple HTML Email Body with <> expression that you could share?
I’m struggling…
Phil
August 7, 2019, 4:29pm
9
I would create a Google Doc and then use the Google Docs export feature to save it as an HTML file. That will allow you to see exactly what your HTML should look like.
Do this as follows:
Create a Google Docs file
Go to the Google Docs file menu
Select “Download as” > "Web page (.html zipped)
Unzipped the resulting file
Open the HTML file to see the Google Doc exported as HTML
That is exactly what AppSheet is doing when you use a Google Doc template.
4 Likes
@Phil I did exactly what you said. Then I copied the HTML and pasted it into the Email Body.
Error: Workflow rule 'Bestellung Parent' action 'Action 1' Body template. Template could not be loaded due to exception: The 'meta' start tag on line 1 position 14 does not match the end tag of 'head'. Line 1, position 5323.
I had to delete the <meta content="text/html; charset=UTF-8" http-equiv="content-type"> Part. After that I also needed to change the special character ä into “ä” and the “Ja” into "Ja".
Phil
August 8, 2019, 4:31pm
11
Glad to hear that you got it to work.
@Fabian_Weller Does this part really work for you?
<a href='<<CONCATENATE('https://www.appsheet.com/start/893a9bce-fd34-4ecb-a9bb-1d7cc344ae2b#appName=Inventur-38452&page=detail&row=',[Key],'&table=Kommission&view=Kommission_Detail')>>' target='_blank' rel='noopener' title='Bestellung öffnen'>
I have a similar part in my HTML, but I get an error since I added this part. Any idea why it fails?
<p><span><<[Material].[Bezeichnung]>> (<a href="<<[Material].[Produktkatalog]>>">Produktinfos</a>)</span></p>
<<[Material].[Produktkatalog]>> should give a link.
Error message is quite unhelpful as line 1 position 1001 does not exist in my html:
Hi @mika134 yes it is still working. This is my HTML code in the field “Email Body”.
Show More
Bestellung
Show More
Show More
Mitarbeiter:
<>
Kommission:
<>
Bemerkung:
<>
Händler
Artikelnummer
Artikel
Anzahl
Bemerkung
<<Start:ORDERBY([Related Bestellungs] , [Händler])>><<Händler>>
<<ArtikelNr.>>
<>
<>
<>
<<IFS([Lagerfach] = “Ja” , “Lagerfach anlegen!”)>><>
Show More
Show More
[details=Show More]
Show More
" alt=“Bestellung öffnen” width=“300” height=“50” caption=“false” style=“float: left;” />
Show More
Show More
Show More
Show More
Maybe the problem in your code is the round brackets? I think you should not use them.
(<a href="<<[Material].[Produktkatalog]>>">Produktinfos</a>)
Thanks @Fabian_Weller
I found an easier way, at least for me. I now use the appsheet variable instead.
<<HYPERLINK([Material].[Produktkatalog],"Produktinfos")>>
1 Like