+ Start a Discussion
Gary WGary W 

Why is my custom link formula field reference returning the value of the wrong field, when the referenced field is blank?

I want to use the value of the account custom text field named 'Id__c', in a custom link on the account object. I want the custom link to go to two different pages depending on if there's a value in the 'Id__c' field or not.

My formula looks like this:
{!IF(
    ISBLANK( Account.Id__c ),
    URLFOR("http://isBlank.com", null),
    URLFOR("http://isNotBlank.com/" & Account.Id__c, null)
)}


/* I'm using the URLFOR() function in order for the URL returned by the function to be properly encoded */
If the 'Id__c' field is blank, I would expect the link to go to http://isBlank.com, however upon testing:
  • If the 'Account.Id__c' field is blank, the link goes to http://isNotBlank.com/001m000001Fc4xR.
  • If the 'Account.Id__c' field has the value "12345", the link goes to http://isNotBlank.com/12345.

As you can see, the ISBLANK() function is always returning false, since if the 'Account.Id__c' field value is actually blank, the function appears to be evaluating the 'Account.Id' value instead, which can never be blank. Either way, it's always evaluating a non-blank value.

I simplified the formula for testing, to just the following:
http://example.com/{!Account.Id__c}
  • If the 'Account.Id__c' field is blank, the link goes to http://example.com/001m000001Fc4xR.
  • If the 'Account.Id__c' field has the value "12345" the link goes to http://example.com/12345.
I believe this is a bug. How can I workaround this issue to effectively test for a blank value in my Id__c field?

Here's some screenshots showing the issue:
User-added image
User-added image
User-added image
I verified that the field is actually blank using Salesforce Inspector.
User-added image