I'm currently using a formula field with a HYPERLINK function in the Account object to show the value of Custom_Object_Field__c from a custom object which also redirects the user to the custom object record page when clicked.
Here's the formula expression so far that is working when the user is viewing from the record page with a URL https://mysite.sandbox.lightning.force.com/lightning/r/Account/000000000000000/view
(take note of the '/r/'):
IF( Custom_Object__r.Custom_Object_Field__c= "",
"None",
hyperlink("../../Custom_Object__c/" + Custom_Object__c.Id + "/view", Custom_Object__r.Id.Custom_Object_Field__c,"_self")
)
However, when the user views from the list view of the Custom Object with a URL https://mysite.sandbox.lightning.force.com/lightning/o/Account/home
(take note of the 'o'), it doesn't work since I don't have the condition to append the '/o/' when viewing from the object list view.
How should I reference and differentiate the URL in the formula expression so I can write a CASE() function?
I already tried fetching the base URL but the /lightning/o/
or /lightning/r/
are not being included.
Thanks!