+ Start a Discussion
Frances AllenFrances Allen 

Update Date Picklist Value with Trigger (No new values)

If there is a post out there that covers this specifically, feel free to point me in that direction. I've researched the tar out of this one.

I need to update a picklist with a trigger using a value that is already a global value, not inserting a new value. The picklist gives me dates in this format:

2018 - 2019
2016 - 2017

I want the trigger to update a picklist value that is '2016 - 2017' to '2018 - 2019' after the record is saved. Originally, I was thinking that Apex might treat these values as an array and I could iterate from [0] to [1] etc. I don't see this capability baked into any code out there. I'm aware of the getPickListValue(), but this method seems to be used for value insertion or detection, not update.

Is this type of updating possible in Apex? If so, how? If not, are there Salesforce tools I can use to essentially tell the system ' on selection of this boolean field, after a save, update the picklist value to the next in the sequence' - as we're never going to skip years on this update. This picklist exists to place opportunities into a consecutive fiscal year.

Thanks All.
Prakash NawalePrakash Nawale
Hi Frances Allen,

No , We can't increment in Salesforce, you have to write trigger and manipulate values with apex logic. 

Hi Frances,

Picklist values are a part of Salesforce Metadata i.e. constant in all form and cannot be updated via apex code. But, API can work over here. 

Please try your luck with METADATA API


Skype: gaurav62990