is it possible to add a one object record field value to another object picklist value

Basically the idea is this:

I have 2 objects, “A” and “B”.

I have a picklist on object A with say 3 values: e,f,g.

Let’s say I add a new value to that picklist in object A called “h”
When that happens, I want SF to programmatically insert a new record on object “B”, with say a name “h”.

I don’t see how I trigger could do this since we’re talking about adding a new piece of metadata, and not actual data, but, maybe it’s possible and I don’t know how. Just curious I think.


There is no direct trigger on metadata changes.

But there are 2 workarounds by which you can capture the changes in pick list values.

1) Write a scheduler class and check periodically if there are any change in pick list values.
pros: this will work great with slight delay
cons: depending on your implementation and number of changes to picklist there can be lot of processing.

2) Store the pick list values in custom setting and write trigger on object A and when ever user enter any new record check if any pick list value is new (by comparing it with custom setting). Id its new insert record in B

pros: very efficient in processing. No SOQL needed
cons: If you dont insert any record in object A then it will not trigger the the sync process so record will not be inserted in B.

Source : Link , Question Author : chvlnaraya , Answer Author : AtulRajguru9

Leave a Comment