Join our Community in its new Home - The Datorama Trailblazer Community Group!

It's been an amazing 3 years coming together in this forum to collaborate, innovate, support, and inspire each other about our shared usage of Datorama. While this is not quite a goodbye, we are excited to announce that we are getting a fresh start in our new home within the Salesforce Trailblazer Community. We have a ton of fun new content planned and you may even see the revival of some of our most popular posts from the past few years.

We’ll be keeping this group around for a bit for you to peruse, but as of November 15, we will no longer be allowing new posts or comments. Be sure to join our new group at to keep the conversation going.

We can’t wait to see you there!

Hyperlink Question

Best Answer

  • MarissbcMarissbc New YorkSYS_ADMIN IMG42
    edited March 2021 Accepted Answer
    Hi @George_Enos

    I have a solution for you! 

    So what you will need to do is: 

    1.  Copy and paste the following HTML in the HTML section of the Custom Widget:

    <a id="link" href=" ">Link Text</a>

    **this code creates the hyperlink.  You can replace "Link Text" with whatever you want to see as the name. Notice the "href" is blank, since we will use the "id" to fill it in with the URL with JavasScript. 

    2. Create a Calculated Dimension that only contains the end of the URL that is changing (i.e., so in "") this Calculated Dimension should return "hello" as text.  Not sure where you are pulling the full link from but you can probably use the EXTRACT() string function to pull the text after the last '/'

    3. In the JavaScript portion of the Custom Widget copy and paste the following code: 

    var queryResult = DA.query.getQueryResult();

    var result = queryResult["rows"][0][0]['value'];



    document.getElementById('link').src =
    '' + result;

    ** The second line of code queries queries the calculated dimension with the end of link text. The third and fourth line output the query values in the console log in the Custom Widget, so if the console log is blank, then you will know that the query did not find the value of the end of link text.  I often use a JSON viewer to make sure I am indexing correctly to get the value. So with this tool, you can copy and paste everything in the console. between the curly brackets into the text and then toggle to viewer to see the data structure. From here starting to the left, it will be obvious if [0][0] is the right way to get to the value, or maybe it is [0][1] or some other combination to get to the value of the end of link text. 

    Finally, the fifth line identifies the "link" id in the html so it can paste the URL there in the href section. 

    On the last line, you will input your base URL that never changes where '' is. 

    Let me know if there are any questions along the journey! 



  • MarissbcMarissbc New YorkSYS_ADMIN IMG42
    Hi @George_Enos

    I am so glad it works!! Oh, that is a good note! I did not catch that and it makes so much sense because there is the 'href' parameter there! 

    Phew! Glad this one worked out well  :) 

    Have a great day!!

Sign In or Register to comment.