I have to use an address field in a formula field but the formula returns the following error:
Error: Incorrect parameter type for function 'IF()'. Expected Location, received Text
The formula is as follows:
IF(MSM_AlmacenCarga__r.MSM_CodigoAlmacen__c = '8058', MSM_AlmacenCarga__r.MSM_DireccionAlmacen__c,
IF(MSM_ClienteEnvioPdV__r.RecordType.DeveloperName = 'MSM_Distribuidor',
IF(ISBLANK(MSM_ClienteEnvioPdV__r.BillingStreet), "" & BR() , MSM_ClienteEnvioPdV__r.BillingStreet & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.BillingCity), "" & BR(), MSM_ClienteEnvioPdV__r.BillingCity & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.BillingPostalCode), "" & BR(), MSM_ClienteEnvioPdV__r.BillingPostalCode & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.BillingCountry), "" & BR(), MSM_ClienteEnvioPdV__r.BillingCountry & BR()) &
IF(ISBLANK(Account.Phone), "" & BR(), Account.Phone & BR()),
IF(MSM_ClienteEnvioPdV__r.RecordType.DeveloperName = 'MSM_DireccionEntrega',
IF(ISBLANK(MSM_ClienteEnvioPdV__r.ShippingStreet), "" & BR(), MSM_ClienteEnvioPdV__r.ShippingStreet & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.ShippingCity), "" & BR(), MSM_ClienteEnvioPdV__r.ShippingCity & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.ShippingPostalCode), "" & BR(), MSM_ClienteEnvioPdV__r.ShippingPostalCode & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.ShippingCountry), "" & BR(), MSM_ClienteEnvioPdV__r.ShippingCountry & BR()) &
IF(ISBLANK(MSM_ClienteEnvioPdV__r.Phone), "" & BR(), MSM_ClienteEnvioPdV__r.Phone & BR()),
"")
)
)
MSM_CodigoAlmacen__c is a string and MSM_DireccionAlmacen__c is the Address field.
Is there any way to solve the error?
Edit: Added actual formula
CustomFieldA__c = 'X',
bit looks like it'd be the issue, but it's hard to say what the fix would be with it being obfuscated/generic-ified. Seeing the actual field name and value you're testing against would be helpful (also, isCustomFieldA__c
a field of type Location? or is it a relationship field to an SObject named "Location"?). Please edit your question to add that clarification.GEOLOCATION()
function in concert withDISTANCE()