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
SFDCTech1SFDCTech1 

Apex trigger

I have industry field having some values and now i want to update those values with new adding some more functionality. Please provide how to write a trigger on this
bob_buzzardbob_buzzard
What type of field is Industry?  Are you looking add more picklist options via Apex - unfortunately you can't do that.
SFDCTech1SFDCTech1
Actually i have a picklist of values in Industry. In that industry for 2-3 values i have to update with another value in place of those values by following some more functionality like in user object some picklist and in the lead some field value comparision. After comparing i have to update those values. Is it possible? if it is not why? any specific reason.
bob_buzzardbob_buzzard
I'm still not clear I'm afraid - are you trying to update the value of the industry field on a record, or are you trying to add some additional options to the pickist like you would through the setup menu?
SFDCTech1SFDCTech1
ok i will explain in detail: there is a custom picklist like *region* in user object in that the values are like usa - CA, usa - LN, United kingdom- SG, United kingdom- UI like this. and in the lead object there willl be *another picklis*t having values USA, United kingdom. Now the functionality i have to perform is if *region *Contains USA and *another picklis*t is USA. We have to update Industry field (picklist) in lead with a new value in place of an existed values
bob_buzzardbob_buzzard
Okay, so it sounds like you want to update the configuration of the lead sobject, rather than a particular instance.  There is no supported way to do this from Apex.  You may be able to consume the metadata WSDL using the Financial Force apex wrapper:

https://github.com/financialforcedev/apex-mdapi

SFDCTech1SFDCTech1
Could you plz explain me in detail
bob_buzzardbob_buzzard
I don't have any more detail I'm afraid.  You can't do it directly from Apex.  Financial Force have some code that may allow you to do this, but I've not used it.