function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC ROCKSFDC ROCK 

How to write Formula Field for date field and picklist field

Hi All,

I have two fields 
1.abc (Date)
2.def (picklist) (2020,2021,2022,2023,2024......2050).
I want to create 3rd field (FORMULA FILED) where I want to update def based on abc whenever I choose any date from abc field the year should get coppied to the field def.

example :
abc : 1/2/2020
def : 2020

I have same logic on process builder which I want to deactivate and
write formula field.

Thanks,
Subodh

 
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Subodh,

With formula field you cannot update other field.You can update other fields only using workflow,process builder or triggers.If you want to set def based on abc using a formula field ,it is not possible.Basically a formula field is read only field ,which evaluates its value based on formula we give in it.

We cannot create a formula field with return type as picklist.
For this you can create def as a formula field and set its return type as text and give the following formula
TEXT(YEAR(abc__c))

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards