So I had a business requirement of creating a certain type of field (I called it Account Link) that is basically a link to an account name or id. This was quite simple and this is how I created it:
HYPERLINK('/' +
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Parent.Name)), Parent.Parent.Parent.Parent.Parent.Id,
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Name)), Parent.Parent.Parent.Parent.Id,
IF(NOT(ISBLANK(Parent.Parent.Parent.Name)), Parent.Parent.Parent.Id,
IF(NOT(ISBLANK(Parent.Parent.Name)), Parent.Parent.Id,
IF(NOT(ISBLANK(Parent.Name)),Parent.Id,
Id))))),
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Parent.Name)), Parent.Parent.Parent.Parent.Parent.Name,
IF(NOT(ISBLANK(Parent.Parent.Parent.Parent.Name)), Parent.Parent.Parent.Parent.Name,
IF(NOT(ISBLANK(Parent.Parent.Parent.Name)), Parent.Parent.Parent.Name,
IF(NOT(ISBLANK(Parent.Parent.Name)), Parent.Parent.Name,
IF(NOT(ISBLANK(Parent.Name)),Parent.Name,
Name))))))
The problem is that business now wants to use the 18 digit id instead of 15 and thats where I am stumped. I know salesforce allows to use the CASESAFEID() method but that would be a formula field within a field . In other words, i tried replacing wherever i have Id with CASESAFE(ID) but it doesnt work. I also made a separate field that converts the 15 digit id to 18 and then referenced that field name (account_18_id, I called it) and replaced that with wherever I have id in the formula field. But that does not work either because in both cases I get the errir:
Error: Compiled formula is too big to execute (14,809 characters). Maximum size is 5,000 characters
Can someone please help me resolve this issue?