Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

formatting email body , replacing string with hyperlink

EtamSoko
8 - Asteroid

Hi Alteryx users,

 

I want to send emails with dynamic body to customer so I placed a variable into the original input like :

 

"Tell us how we did by clicking on this link: ***"

 

Then I thought by replacing *** with the hyperlink that I created with Report Text tool would solve my problem but the result was:

 

"Tell us how we did by clicking on this link: <div class="DefaultText" style="width:100%;"><span style="font-family:Arial;font-size:12.0pt;"><a href="[link to survey]" >Survey link</a></span></div>"

 

I am guessing the problem is that before Email sending tool I used another Report Text tool to create the final ‘Body’ field which contained the body field and the hyperlink.

 

Is there any way to change the format or keep this as a hyperlink?

 

As I need to send emails in many languages depending on the country, I was looking for solutions to avoid having multiple Report Text tool in the workflow.

 

Thanks a lot in advance!

M

 

9 REPLIES 9
mbarone
16 - Nebula
16 - Nebula

I've never tried it in an Email tool, but I have done it in a render tool.  What does you Report Text tool configuration look like?

patrick_digan
17 - Castor
17 - Castor

@EtamSoko Can you use the add hyperlink button in the report text tool? You can reference a field:

patrick_digan_0-1619178386990.png

 

EtamSoko
8 - Asteroid

@patrick_digan 

 

Sorry if my explanation was not clear. So I have a column called Body and Link. From the Link field I have already created a new field called 'Hyperlink' using Report Text tool.

 

MateK_0-1619182491586.png

Then in the Body field, I have the email text and in the place of the survey link I placed '***' variable to the original input, then Formula tool to replace the '***' with the hyperlink.

MateK_3-1619182838733.png

At the last step before the Email tool, I have another Report Text tool to create the Final Body column for the email tool to use that field as the Body. I have more email body fields because there are customers that should receive the email in more languages.

 

MateK_2-1619182627940.png

Then, when I send the email this is the format I get back of the survey link:

 

<div class="DefaultText" style="width:100%;"><span style="font-family:Arial;font-size:12.0pt;"><a href="[link to survey]" >Survey link</a></span></div>"

 

Does this clarify a bit more? Hope you will be able to help me. 

 

The workaround ofc would be to create Report text tool for each country and than channel the workflow accordingly but this solution could be dynamic and easly controlled by inputs.

 

thanks!

 

 

mbarone
16 - Nebula
16 - Nebula

For the report text tool, the incoming link field needs to be of the format:

<a href="FULL URL HERE">TEXT TO DISPLAY HERE</a>


And leave those quotes in there.  Can you confirm that's how your incoming link field is going into the report text tool?

apathetichell
18 - Pollux

I think you are trying to create a link to something already set up as a link. and that is your problem.

 

Am I misreading this or are you:

1) creating a link in report text.

2) adding it to a non-link in formula.

3) turning that entire field into a link.

 

since section 1 is already a link you are creating a link to a link - instead of a link to the underlying. 

patrick_digan
17 - Castor
17 - Castor

@EtamSoko I see now. So in your formula that is replacing the *** with your link, it's creating some bad html behind the scenes (it's nesting some div and span html tags illegally). I think you have 2 options:

1) assuming you're building emailbody1 in a report text tool, you would need to already have joined your hyperlink fields before and create it all in one report text tool. I'm also assuming this probably breaks your ability to keep everything dynamic (although I don't have a good picture in my head at the moment).

2) You could leverage @mbarone 's code in the formula tool. So don't put your hyperlink through a report text tool, and change your formula tool to something like:

 

replace([emailBody1],"***",'<a href="' +[Link]+'">' + [Text]+'</a>')

 

 By building the link yourself and not in a report text tool, the html should work.

patrick_digan
17 - Castor
17 - Castor

@EtamSoko and I almost forgot, when you're building that final report text, you'll need to use expert mode. Attached is a simple example.

mbarone
16 - Nebula
16 - Nebula

Sorry, should've clarified - if you do use what I posted in a Report Text tool, you need to check the "Expert Mode".  If you do that, it will come through as a hyper link, then you can (conceivably) put it in an email tool.  For my use case, I give the end-user a list of clients with a hyperlink to the google maps of their address.  I use the report tool as shown below (expert mode), feed it into a table tool, then render that table tool as a PDF (that's what they wanted - a PDF with hot links).

 

The Address field comes from a formula tool ('<a href="http://maps.google.com/?q='+[ClientAddr_Address]+', '+[ClientAddr_City]+', '+[ClientAddr_State]+', '+[ClientAddr_Zip]+'">'+[ClientAddr_Address]+'</a>')

 

 

2021-04-23 12_08_58-alteryxpnv01 - Remote Desktop Connection.png

EtamSoko
8 - Asteroid

@mbarone , @patrick_digan 

 

thanks guys for the help, I managed to resolve it with your comments. I appreciate it.

 

However, I have faced some issues while using the solutions.

 

I have came across with the following error:

 

Email (49) Exception parse error line: 1 column: 40 An exception occurred! Type:UTFDataFormatException, Message:invalid byte 2 (c) of a 4-byte sequence.

 

in this project, I have text in multiple languages, and for the sake of testing I used text in German. This is where it failed, but once I removed special characters like ä,ö,ü, it did work. 

Question 1: at which point and how should I changing the encoding?

 

Question 2: How can I format now my email body to look pretty? I need to see the following layout:

 

Sehr geehrte Damen und Herren,

 

"Wir möchten Sie um Ihr Feedback in Bezug auf Ihre letzte Kontaktaufnahme mit unserem Customer Care Center bitten.

Sagen Sie uns, wie Sie mit unserem Service zufrieden waren, indem Sie auf diesen Link klicken: -link to survey-

Diese Umfrage dauert ca. 3 Minuten und Ihre Meinung wird uns dabei weiterhelfen, die Qualität unseres Services zu verbessern.

 

Vielen Dank."

 

However, in the email it comes without line breaks, and a shorter message I am guessing because of the embedded new lines (it comes in as an input) and over 256 characters.  How should I proceed with this issue?

 

I appreciate the help in advance!

MaK

 

Labels