How to create a URL in the Rules Engine

  • 19 December 2019
  • 20 replies
  • 1487 views

Userlevel 7
Badge +2

Today’s tutorial covers how to create URLs in the Rules Engine. A good use case for this, as I describe in the video, is if you need to tokenize links to multiple Salesforce records in the CTA comments or scorecard comments. In my example, I tokenize links to two Opportunity Products and then include those in the CTA comments. 

 

 

The guide for how to put these URLs together can be found via this link: 
https://www.w3schools.com/tags/att_a_href.asp. The instructions are to use the concatenate formula field in a transformation task, then put in the following code: 

 

<a href=”  

hit enter

Input your URL - in my case it was https://na85.salesforce.com/

hit enter

Then tokenize whatever it is you want to link to; in my case the opportunity product ID

hit enter

“>

hit enter

Type in the text you want the link to display; in my case “Link to Product”

hit enter

</a>

hit enter and save

 

Let me know if you have any questions! 


20 replies

Userlevel 7
Badge +1

Thanks for posting this here!

Badge +1

Hi @spencer_engel is this logic still supposed to work? I know this is a year out of date. I attempted this, but what ends up happening is all the html code gets displayed in the output. When I just concatenate my URL and my tokenized value the URL works, but I would prefer if it didn’t display the entire URL, but rather the text I’d like.

Userlevel 7
Badge +2

Hi @spencer_engel is this logic still supposed to work? I know this is a year out of date. I attempted this, but what ends up happening is all the html code gets displayed in the output. When I just concatenate my URL and my tokenized value the URL works, but I would prefer if it didn’t display the entire URL, but rather the text I’d like.

As far as I know that solution should still work, but I admittedly haven’t tried it for a while. Thinking outside the box, if your concatenated field works, maybe you could do one more transformation on that field and do a case expression with the logic being “if URL starts with HTTP, then transform to a custom string field of (insert text here)”...thoughts?

Userlevel 2
Badge

I’m not sure if this is a Gainsight NXT difference but I was having issues getting the Concat field to save. In case anyone else has run into this issue, It worked once I changed the closing expression from “</a>” to “/a>”.

 

Edit: The above caused the rule action to fail. Below is the setup in Gainsight NXT that I was able to get to work in both the task configuration and the Action.

 

Concat(<a href=",https://URL/,Opportunity ID,/view,">,Link to Opportunity,<,/a>)

 

Another thing I had to change was make the destination field in Data Management a String NOT a URL. It is still a clickable link as a string in reports.

Badge +1

Yes, I had the same issue a few weeks ago, even though I have an existing rule running that works fine. But I can’t save this logic in a new rule.

Userlevel 2
Badge

@kytpowell I wanted to alert you to my edit. I was able to get the clickable link to work in rules engine by changing my field to a string from a URL in Data Management and splitting the “<” and “/a>”per the below.

 

Concat(<a href=",https://URL/,Opportunity ID,/view,">,Link to Opportunity,<,/a>)

Userlevel 6
Badge +8

@jkolle thank you for your extra insights here!

 

I’m still running into issues. My action is loading to a String field. The issue I’m seeing is that it looks like a clickable link, but it is not clickable and not linked.

Here is my concat & screenshot from my report where I’m trying to click on it. What is strange, is that in my preview of the transform task step in a successful rule, it is clickable (last screenshot)

 

Here’s what’s happening in my rule result export:

 

Userlevel 6
Badge +8

Fixed -- copying/pasting the web address was causing extra spaces at the end of it in the concat. I typed it out by hand and then it worked

hey, i tried similar way but it does not work rather it shows whole in export CSV.Can you plz advise

 

@jkolle / @sarahmiracle , can you please advise? Thanks

Userlevel 6
Badge +8

@Syed what do you mean it shows whole in the export? Can you share an example of what your export looks like?

@sarahmiracle , i mean in output, wen i test the rule. It shows like below:

 

Userlevel 2
Badge

@Syed That’s correct, the export will show the URL but in the tool and report builder you will see the formatted text in a clickable link. If you add the field to a report and export it will show the full url. I confirmed in my instance the same behavior.

@jkolle thanks for your help.Its working fne but in order to URL to work, i do right click and open in new tab.Is there anyway, if we can do with one click?thanks

hi 

Currently, i am using like this

Concat(<a href=",https://lightning.force.com/,Record ID, target="_blank", ”>,Link,<,/a>

 

Userlevel 6
Badge +8

Hi all - I wanted to share that I ran into an issue with this solution after the new Data Operations was introduced. The new Data Operations now has a validation step for String values that will not allow you to save updates made in Data Operations when you have String field values that exceed a certain character limit. I have 11 fields that I use this ^ solution for and use Rules Engine to populate the field value, which works successfully. This now means that using this solution means I cannot use Data Operations at all, as all of these fields will hit that same error.

I’m submitting a ticket to Support, but I wanted to raise here as well because I believe you will all be in the same boat.

@sarahmiracle - I had the same issue as you, where it creates what looks like a clickable link, but you can’t click it. I even tried what you did and typed out the URL in case a space was causing an issue, but it was still not working. 
I am using Gainsight NXT. I am creating the hyperlink via a rule and writing it to a string field. 
 

Concat Formula in Rule
Report view of output looks like you can click it but nothing happens

Any suggestions would be helpful! 

Badge +3

Hi Team,

I am creating milestone activities via rule and trying to insert a URL into notes section and this solution doesn’t work.. Any suggestions?

 

 

Userlevel 5
Badge

Got this to work with two adjustments.

 

  1. I add the <p> tags
  2. I have the target="_blank" piece added in

 

 

 

I dont think the target blank is needed as that’s to open in a new tab.

 

Something I noticed on yours also

 

 

Badge

Very useful post

Reply