I've to check whether the WhoId value is Contact or Lead. If I convert WhoId to text then I can check if by standard object prefix like '003' for Contact. So is there any possible way to convert WhoId to Text in formula fields?

I tried with the formula:

IF( BEGINS(TEXT(WhoID), 003),'Contact','Lead' )

which produces the error:

Incorrect parameter type for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Lookup(Contact,Lead)

  • 1
    Have you considered simply using Who.Type? Where are you consuming this data?
    – Adrian Larson
    Mar 6, 2018 at 18:33

1 Answer 1


Use WhoId rather than Who.Id. Don't wrap it in the TEXT function either. The value is an Id which behaves as text already. This formula passes a syntax check just fine:

    LEFT(WhoId, 3),
    "003", "Contact",
    "00Q", "Lead",

Please note if you are trying to access this data via SOQL, you do not even need a formula. You can query or filter on Who.Type.

SELECT count() FROM Task WHERE Who.Type = 'Lead'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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