[SalesForce] Incorrect parameter type for operator ‘&’. Expected Text, received Number (Related field: Formula)

I have Pin field which is a formula field and PIN should be DDMM part of DOB of customer.

I have written a foll formula and it gives error

DAY( Customer_id__r.Date_of_Birth__c )  & MONTH(Customer_id__r.Date_of_Birth__c)

and the error is

Incorrect parameter type for operator '&'. Expected Text, received Number (Related field: Formula)

Can some one help pls

Best Answer

The & concatenation operator expects the left operand and right operand to be text. But DAY(Customer_id__r.Date_of_Birth__c) returns integer and so throws syntax error.

You can surround the DAY and MONTH functions with TEXT() function like

TEXT(DAY(Customer_id__r.Date_of_Birth__c)) & TEXT(MONTH(Customer_id__r.Date_of_Birth__c))

Hope it helps.