1

I have an external system which keeps synchronized with Salesforce. I have triggers in every object that send the inserted/updated/deleted records to my webservice, and every minute I send the modified records in the system to Salesforce.

Now I would like to store a picklist values in my system as well. Ideally I would like something similar to a trigger that runs when the picklist values are updated (add one option, remove or rename it) but I can't see how this could be possible.

The only way I can think of would be to fetch the values at intervals by using the metadata API, but I would rather initiate the connection from Salesforce when there is a change instead of doing so from my server at fixed time intervals.

Is there any way to accomplish this? I am using Java by the way.

1

There's no such thing as metadata triggers, so your system can't be notified the instant such a change occurs. It would be possible, however, to write a scheduled job that checks the values in various picklists (using SObjectField.getDescribe().getPicklistValues()) and replicate those changes to your system. In this case, all you're doing is trading responsibility of updating the lists from your system to Salesforce. In either case, a polling loop is necessary, so you simply need to determine who should pay the price (I'd be willing to bet that it would be less of a headache to manage in Apex Code...).

  • That is a great idea, thanks man! BTW, if I were you I wouldn't be so sure of that bet ;-P – momo Jul 4 '14 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.