I am looking to add a URL into a text field in a similar fashion to the way you can add a HYPERLINK
in a Formula (Text) field. I have already taken a look at the information in How to give a URL field Link text and this is currently how I am getting a hyperlink. Currently the hyperlink formula looks something like this:
HYPERLINK("https://a-web-address-i-use.com/browse/" & Custom_Field__c , Custom_Field__c )
This HYPERLINK
gives me something that looks like this somedata which works. However users need to be able to enter multiple items into the Custom_Field__c
.
I was hoping to use the System.Url Class, however, I seem to be breaking something here.
I have created the following trigger to attempt to add the URL but it is not working.
trigger textLinkChangedTrigger on Case (before update)
{
for (Case c : Trigger.new)
{
System.debug('This is the start of the textChangedTrigger event');
if (c.text__c != null)
{
Case caseOld = Trigger.oldMap.get(c.Id);
String text = c.text__c;
List<String> Tickets = text.split(',');
if (c.text_Link_Replacement_Rich__c == caseOld.text_Link_Replacement_Rich__c)
{
c.text_Link_Replacement_Rich__c = '';
}
for (String t : Tickets)
{
// Will use this to trim the whitespace then remove all spaces from the strings
t = t.trim();
t = t.replaceAll('(\\s+)', '');
System.debug(t);
System.Url j = System.Url('https://text.mywebsite.com/browse/' + t, t );
System.debug('The current text Link is: ' + c.text_Link_Replacement_Rich__c + ' The added text link is: ' + j);
c.text_Link_Replacement_Rich__c = c.text_Link_Replacement_Rich__c + j;
}
}
}
}
I receive the error:
Method does not exist or incorrect signature: void Url(String, String) from the type System.
Any assistance or information would be greatly appreciated
Note these Images are from a private sandbox and not the production sandbox, however the settings match across. Just can't show production for privacy
キリトくん
Method does not exist or incorrect signature: void Url(String, String) from the type System
. Through from my understanding there should be a constructor inSystem.Url
as shown by URL Constructors The following are constructors for URL. Url(context, spec) Creates a new instance of the URL class by parsing the specified spec within the specified context.IF
statement and theHYPERLINK
however I needed 1IF
statement for every iteration as there was no loop in formulas