0

I have installed one package in my org. when i write one trigger on campaignMember then it get in recursive call due to managed package trigger. Now i want to merge my code in package code. I want any suggetion how can i do that?

  • 2
    you can't see and edit your managed package code. One way is to get the code from github if it is available from there and edit it. – sanket kumar Aug 17 '18 at 10:00
  • If i can't use their plugin and then merge my code in that? – SalesforceFolks Aug 17 '18 at 10:03
4

Unfortunately, you are not able to change managed package code since that is managed by package provider. You can imagine that a compiled library that you are used, where you are aware only about available interfaces only, but no more.

You can do following things in here:

  1. Ensure that your trigger is not recursive and as much safe as possible (so it does apply only necessary changes)
  2. Contact provider of the package and explain your problem, so they can probably give you a hint how to avoid recursion

If that package is open source -- then you can (depending on license) get unmanaged version of it, and perform necessary adjustments.

This is an addition to previously given answer.

That is a first time that I have ever seen this package(fullcircleinsights) and their documentation.

I wrote some pseudocode based on their documentation, based on their documentation -- link. (which is really good, one day I will start writing same I hope).

It should give you a way how to write it. Please, ensure that returned types are correct and data is being returned. So, your class should have following methods (based on documentation of interfaces):

  • ExtensibilityEvent
  • GetUniqueName
  • RequestedAPIs
  • RequestedFields

The most important method is apparently ExtensibilityEvent. It may be executed in various places, for example in Trigger. In that case, PostSequence will be returned as eventname (according to event reference in pdf)

Here is an example plugin.

global class SamplePlugin Implements FCRM.FCR_ExtensibilityAPI.IExtensibilityPlugin {
    global void ExtensibilityEvent(String eventname, FCRM.FCR_ExtensibilityAPI.IExtensibilityEventArgs args) {
        if (eventname = 'PostSequence') {
            // Returns 2 maps (or less) based on trigger event
            List<Object> data = this.getRecordMaps();
            // returns params, according to PDF link above
            List<Object> params = this.getAdditionalParams();
            //so if it is campaign member, and event is before/update, page 6 of PDF file
            if ((String)params.get(0) == 'CampaignMember' && (Boolean)params.get(3) == true && (Boolean)params.get(5) == true) {
                // do some dirty job
                Map<Id, Object> new_map = ( Map<Id, Object>)data.get(1);
                for(Object cm : new_map.values() ) {
                    CampaignMember cm_parsed  = (CampaignMember)cm;
                    //Change it in way that you want
                }
            }
        }
    }
    global String GetUniqueName() {
        return('SamplePluginName');
    }
    global SET<String> RequestedAPIs() {
        //no clue so far
        return new Set<String>();
    }
    global Map<String,Set<String>> RequestedFields() {
        return null;// no impact in trigger
    }
}

In the end, do not forget write tests (they have guide too) and to register you plugin by calling as anonymous apex following:

FCRM.FCR_ExtensibilityAPI.InstallPluginClass('SamplePlugin');
  • if i can't use their interface and use extensibility plugin for this? – SalesforceFolks Aug 17 '18 at 10:10
  • If they provide such an interface -- then you can do it. (personally I did that for some of managed packages). – kurunve Aug 17 '18 at 10:13
  • in their docs i read that there is interface which i can use. Can you please help me how you do that so i can take a reference from their. – SalesforceFolks Aug 17 '18 at 10:51
  • @SalesforceFolks please, share package name, and documentation for it. I have no idea what package are you talking about – kurunve Aug 17 '18 at 11:34
  • Package name is Full_Circle_Response_Management in which after searching i found there is 'Post Sequence Trigger' this we can use. But i not getting how i can do this.please share your answers.support.fullcircleinsights.com/Full_Circle_Response_Management/… – SalesforceFolks Aug 17 '18 at 11:51
0

You can not change the managed package code. For this you can contact the package provider and tell the scenario to them.

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.