Gravatar for jfcadrin@coveo.com

Question by JFCG, Nov 3, 2014 3:16 PM

Can you use jsrender in an Advanced Content to generate clickable links from addresses with and without http(s) prefixes?

Let's say I have a Custom Link, in an Insight Panel, on a field that returns addresse both with and without an http(s):// prefix.

The addresses returned with an http(s) prefix are rendered correctly, but addresses that come in without prefix (say, www.site.com) are turned into something like the following, which is of course invalid.
/////////////////////
https://c.eu3.visual.force.com/servlet/www.site.com
/////////////////////

I thought maybe something could be done with an Advanced Content component rather than the Custom Link, with the proper jsrender code. Would you have any detailed way to get this working, with code samples I could use?

Gravatar for jfcadrin@coveo.com

Comment by JFCG, Nov 6, 2014 3:17 PM

I've been told that this cannot be achieved with plain JSRender, unless one registers a new "helper" function to make it accessible from the template (JsRender being used there because it disallows arbitratry JS code).

So, one would need to use a custom VF page for the panel, and from there register custom helpers with JsRender (http://www.jsviews.com/#helpers for example). This helper would check for a leading scheme in the url, and add it if needed.

However, I'm afraid this could appear daunting for most users, so I'd like to know if anyone has more details or a simpler alternative.

Gravatar for jfcadrin@coveo.com

Comment by JFCG, Dec 9, 2014 7:19 AM

Anyone, please?

1 Reply
Gravatar for gerard.snippe@rembrandt-fo.nl

Answer by ger_art, Nov 10, 2014 5:49 AM

Hello,

This behaviour also occurs in the search interface. We use the normal weblink field from salesforce. we usually copy the webaddress from our browser (including https etc.). in the weblink field. After indexing with coveo we can't use the link. We can only make the weblink work if we manually type in the webaddress without http://. I think this problem is solved when you run a script before indexing to remove the https from the url?

Ask a question