+ Start a Discussion
DarrellDDarrellD 

Run Apex in Subscriber Org for Custom Setting

Want to make sure I didn't miss anything here. I think the answer is "No".

 

We have a managed OEM package installed for a customer. The Post Install script populated our Protected List Custom Setting with incorrect data (case open with SF). So now we need to change the Custom Setting records. I can login as an Admin to customer org and do so manually but I'd rather run a script to do this. If I use Developer Console, it says that the Custom Setting object is not accessible (Protected). is there anything else I can do to change these Custom Setting records??

 

Darrell

aalbertaalbert

You should use the Subscriber Support functionality of LMA to login-as your customer. Have their admin grant you login-access. Then you login on their behalf via Subscriber Support (tab within LMA) and you can modify your protected custom settings directly.

 

 

DarrellDDarrellD

Thanks for this info. I evidently left that part out though as I'm aware of logging in as them through the LMA but you can't modify the Custom Settings, via Apex, with this method. Yes, can edit directly but there are 1000+ records and I'm trying to see if I can do it programatically.

 

I know how to do programatically and script works fine in my DE org but when logging in as customer says that Custom Objects cannot be accessed through Apex in a Managed Package, so I'm trying to see if there is a workaround.

 

I also tried adding the code as part of a postinstall script and having customer "upgrade" but the upgrade failed...which appears to be a separate issue I guess.

 

Darrell

aalbertaalbert

Ah, gotcha. You already learned this, but protected custom settings can only be accessed via managed apex code. The post-install script + push upgrade should work. What issue are you running into there? 

DarrellDDarrellD

I'm about to log a case, and also put a message up here regarding Flows. We are getting a Flow error when doing either a push patch upgrade or release upgrade on our managed package.

 

The way I read the docs, its possible you can NEVER do a patch if you have a Flow in the package?  Aside from that though, it's telling us "Cannot Modify Managed Component" and referencing 4 Flows. Says "The component you are attempting to modify is part of a managed package and cannot be modified"

 

Makes no sense since it's our managed package to begin with.