Hyperlink not working

In a email body of an automated bot, I created a LINKTOFILTEREDVIEW that is working. 

https://www.appsheet.com/start/12345678-9101112-1314-1516-123456789012<<LINKTOFILTEREDVIEW(view name, ([Id] = [_THISROW].[id]))>>

Now I would like to enter that into a HYPERLINK, this is how I entered it and it's not working.

<<HYPERLINK("https://www.appsheet.com/start/12345678-9101112-1314-1516-123456789012<<LINKTOFILTEREDVIEW(view name, ([Id] = [_THISROW].[id]))>>", "Text to display!")>>

Does anyone know why it isn't working?

Solved Solved
0 9 838
1 ACCEPTED SOLUTION

You likely need to use HTML mark-up rather than AppSheet's HYPERLINK function, which probably governs rendering only within an app. Something like:

<a href="http://&lt;&lt;Concatenate(&quot;https://www.appsheet.com/start/12345678-9101112-1314-1516-123456789012&quot;, LINKTOFILTEREDVIEW(view name, ([Id] = [_THISROW].[id])))&gt;&gt;">text!</a>

 

View solution in original post

9 REPLIES 9

I just tried a concatenate() function as well and now the link it's working, but it's not replacing the link for the text:

<<HYPERLINK(
    Concatenate(
            "https://www.appsheet.com/start/12345678-9101112-1314-1516-123456789012", 
            LINKTOFILTEREDVIEW(view name, ([Id] = [_THISROW].[id]))
                ) 
            , "text!"
            )>>

You likely need to use HTML mark-up rather than AppSheet's HYPERLINK function, which probably governs rendering only within an app. Something like:

<a href="http://&lt;&lt;Concatenate(&quot;https://www.appsheet.com/start/12345678-9101112-1314-1516-123456789012&quot;, LINKTOFILTEREDVIEW(view name, ([Id] = [_THISROW].[id])))&gt;&gt;">text!</a>

 

@dbaum It didn't work as expected. Did you mean to have that http:// at the beginning? Anyhow, i tried without it and still didn't work. I might have to just render the email from an HTML file directly. I get all kind of issues when trying to write these kind of expressions in directly in appsheet.


@casitasrd wrote:

Did you mean to have that http:// at the beginning?


When I replied, I didn't try or test anything--I only copied your existing expression into an HTML editor to create a sample for you. I see now that I somehow ended up repeating "http://", which surely is incorrect.

I did just review some Send an email tasks in my own apps, and indeed they include:

<a href="http://...

However, I didn't find any that use an expression to generate the hyperlink. So, I don't have any examples that use either of the following:

...&lt;&lt;Concatenate(&quot;...

...<<Concatenate("...

@casitasrd wrote:

I get all kind of issues when trying to write these kind of expressions in directly in appsheet.


Yes, I often find it finicky.

 

Thanks for your response to this post.  I have never quite understood the construction of links for emails nor when to encode and when its not needed.  

Following your suggested HTML coding I get this:

<a href="http://&lt;&lt;CONCATENATE(&quot;https://www.appsheet.com/start/a5910859-fda5-445d-8d3c-48bbd1f3c963&quot;, LINKTOROW([_THISROW], Practitioners_Form))&gt;&gt;">Adjust this record</a>

I use it in an email body and it creates the link in the email just fine. 

The issue I have is when I click the link, it attempts to open the page BUT it is missing the ":" after the "https" so the page cannot open.  If I manually insert the ":" it then opens as expected.

Screenshot 2022-11-26 at 3.01.32 PM.png

I am nor sure what I need to do to retain the ":" in the final url.  I tried adding the HTML encoded value for a colon.  I tried wrapping the link in an ENCODEURL() function but these just make it worse.

How do I make the colon stay in the final URL?


@dbaum wrote:

I often find it finicky.


and don't know what to suggest other than:

  • &colon; (which I think you're saying you already tried)
  • try including the http:// as one or more concatenated elements
  • the advice I've seen from @SkrOYC--namely, don't use the task's email body property but rather use an HTML template file


@dbaum wrote:

the advice I've seen from @SkrOYC--namely, don't use the task's email body property but rather use an HTML template file


I'll try this.

 

So I'm not sure how to make an HTML template so I backed off that idea.

I started looking at the href link more closely and realized, at least in my use case, there was extra "stuff" not needed.  I had an "http://" as well as an "https://".   Once I removed the "http://", my email link worked great.  I also realized I could just move the URL prefix outside of the pre-processed code (<<...>>) and I didn't need the CONCATENATE() at all.

So after adjustments, I ended up with this reduced href version.

<a href="https://www.appsheet.com/start/a5910859-fda5-445d-8d3c-48bbd1f3c963
&lt;&lt;LINKTOROW([_THISROW],Practitioners_Form)&gt;&gt;">Adjust this record</a>

I hope this helps someone else! 

Concatenate() is mainly not needed when you have just text strings thanks to how the <<>> stuff works. You can place those wherever you want inside your templates