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
Aaron BaugherAaron Baugher 

How to deal with managed packages in a sandbox?

Hello, I'm very new to Salesforce and Apex (about 2 weeks), so I'm still learning the basics and terminology.

I've been given a sandbox (Developers type, I'm told) and asked to create a batch class to process a large number of records. The problem I'm having is that there are already triggers defined on the object I'm working with, so when I run my batch job, those triggers run into the non-batch limits and cause it to fail. So I'd like to edit or delete those triggers. However, they are part of a managed package that was installed as part of the sandbox, so I can't touch them. I can uninstall the whole managed package, but that would make the sandbox worthless for development, since I need those objects, just not the trigger.

Is there a way around this I'm not seeing, that would allow me to disable or edit a trigger in a managed package in a sandbox? Should I have a different kind of sandbox for this sort of work? Thank you.
Best Answer chosen by Aaron Baugher
AbhishekAbhishek (Salesforce Developers) 
Aaron, you are able to edit all of the components that are part of an unmanaged package.

https://help.salesforce.com/articleView?id=sharing_apps.htm&type=5

And It's not possible to edit the code of a managed package. If you click on "edit", you gonna see an empty file.

I hope the above information helps you.

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi Aaron,

You cannot create managed packages from a sandbox. Generally, the sandbox organization is configured to create unmanaged packages only. Unmanaged packages are not upgradeable. You need to signup for Developer Edition to create a managed package.
 
You can migrate all your code from sandbox to developer edition using Force.com IDE or Migration tool. etc
 
To know more about packaging concepts,  go through: 
 
http://wiki.developerforce.com/page/An_Introduction_to_Packaging

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.
 
Aaron BaugherAaron Baugher
Thank you for the reply, Abhishek. I don't need to create packages. I'm trying to work around a managed package which already existed in my sandbox when they created it for me. It provides the objects I need to work with, but it also has triggers that I need to disable, and I can't find a way to do that.

I'll look into migrating to a developer edition. Maybe that would work better for what I'm trying to do. Thank you.
AbhishekAbhishek (Salesforce Developers) 
Aaron, you are able to edit all of the components that are part of an unmanaged package.

https://help.salesforce.com/articleView?id=sharing_apps.htm&type=5

And It's not possible to edit the code of a managed package. If you click on "edit", you gonna see an empty file.

I hope the above information helps you.
This was selected as the best answer
Bryan Leaman 6Bryan Leaman 6
>>so when I run my batch job, those triggers run into the non-batch limits and cause it to fail.
Any triggers invoked during a batch process are restricted to the batch limits, not the non-batch ones.  What matters is the context of the request, not the fact that it's a trigger.  Also, if this batch update that's going to run in your production org at some point your code will have to cooperate with the managed trigger anyway.

You may just need to reduce the number of records you process at a time in the batch process. When you cause it to execute, try specifying a smaller number of records:
Database.executeBatch( new myBatchClass(), 50);   // (the "50" is the number of records per batch. the default is 200, I believe)

If that doesn't work, you'll have to contact your package maintainer and explain your difficulties to them and get advice on how to circumvent their issue or maybe get a patch from them that fixes it.
Aaron BaugherAaron Baugher
Thanks for the help, everyone. Our solution was to create a scratch org rather than a sandbox, and then it was possible to edit/delete the files from the managed package.