Background

I have a custom object Recipient__c with a Lookup relationship to Contact. Also it have another Master-Detail relation to another custom object SomeObject__c. The Name field for this object is defined as Auto Number (R-{0000000}).

By default when recipient records are displayed in a related list for any of its parents, users see "Recipient:Name" as one of its columns. By clicking on this field for any on the records in a list, users will be redirected to the Details page of the record.

The problem with this is that the "Recipient:Name" column displays values as "R-0000008", "R-0000002" etc., which is not very user-friendly, given that there will be many Recipient__c records assigned to a single parent record.

That is why I would like to find a way to have a field like "First & Last Name", which would be displayed on the related lists instead of "Recipient:Name", and it would also need to be a link. When users click on it they would be redirected to the relevant Recipient__c record.

What I did

I created a formula field on the Recipient__c object (HYPERLINK help article):

Field Label: Name

Field API Name: Name

HYPERLINK(Id, Contact.FirstName + " " + Contact.LastName)

Then I added this field to Related lists on the parent object.

Problem

When I go to the SomeObject__c detail page and click on the value in the Name column in the Recipients related list, I am getting the "URL No Longer Exists" error.

enter image description here

This is the actual URL https://<hidden>.my.salesforce.com/a021100000GblirAAB/a0311000007iFjp and it's wrong. It should be https://<hidden>.my.salesforce.com/a0311000007iFjp.

enter image description here

Interestingly when I go back to the SomeObject__c detail page and refresh the page, then the URL in the Name field becomes correct and I am redirected to the Recipient's detail page.

Does anybody know why this is happening?

  • Try adding “/“+Id instead of Id. It needs the relative url I think. – Ranga Sep 14 at 12:01
  • @Ranga, thank you! It seems to have solved my issue. Please post your comment as answer so that I can accept it. – Eduard Sep 14 at 12:30
  • No problem glad it worked! – Ranga Sep 14 at 12:34
up vote 2 down vote accepted

Please add “/”+Id instead of “Id” in your formula field as it requires to be the relative URL.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.