1

I am writing a Formula Field to populate a ID. Here is the requirement I have a text field called work name where the end user gives values called "Core Work" or "Netflix" or "Capacity hoilder" and another field called Work ID which is a Text Field where end users give the field values as "123456"

Now I need to create a formula field called WORK CODE to populate the values "CW.123456" if the Work name field value is Core Work, if the Work name field value is "Netflix" then this formula field should populate "NT.123456", if the Work name field value is "Capacity hoilder" then this formula field should populate "CH.123456". I used the below logic

LEFT(Work_Name__c, 2) + Work_ID__c

but it is updating the new field to "Co123456" and "Ne123456". Please advice

2
  • Hi Ron, You may not be able to use LEFT() function here because there is not particular format for Text field to derive. Can you confirm if are these three the final values or user can enter any values except Core Work, Netflix,Capacity hoilder. Commented Feb 3, 2022 at 6:29
  • User Only enters these three values
    – Ron
    Commented Feb 3, 2022 at 7:28

2 Answers 2

1

You can try using Switch class for formula on here as follows,

CASE( Work_Name__c, 
'Core Work', 'CW.'+ Work_ID__c,
'Netflix', 'NT.'+Work_ID__c,
'Capacity hoilder', 'CH.'+Work_ID__c,
Null //Default
)

Thanks.

0

As confirmed above the users can add only three values you may have to use the formula similar to below.

IF( Work_Name__c ='Core Work','CW.', IF(Work_Name__c ='Netflix','NT.',if(Work_Name__c ='Capacity hoilder','CH.','')
)
) + Work_ID__c

You wont be able to use LEFT() function because there is no particular logic for your formula field to populate from Work Name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .