3

I'm getting an error on inserting Opportunities using the Data Loader: an apex trigger on opportunity insert is trying to dereference a null pointer. In trying to find a solution to this problem, I'd like to have a look at the code in the the opportunity triggers in our org. Unfortunately, most of these are part of a managed package (non-profit service pack contacts & organizations) and I get a "managed code is hidden" message when I try to open them.

Is there anywhere I can go to look up the code in these triggers? I haven't been able to find it documented anywhere.

Or, is this a problem anyone else has had? Is there some common piece of data my uploads might be missing to cause this error? I've verified that the account IDs in my upload are valid.

Update: I think I've tracked down the problem to a bug in the Opportunity Contact Roles class that is de-referencing a null Contact when bulk uploading opportunities to non-1to1 accounts in an org using the one-to-one contact-object model (we are one-to-one but have some organizations without contacts for various reasons). I feel like this is a bug on an edge case scenario and the code should handle the case of no contacts, but I suppose one might argue that having accounts with no contacts in a one-to-one org shouldn't be supported... I wonder if I should submit an issue in Github?

  • 1
    What fields are you inserting? SOP for inserting Opps into the NPSP would be the Account lookup, but also a Contact ID in the Contact ID for Role text field, which creates an Opportunity Contact Role. There's also trigger code that summarizes Opps on Households - if any of those IDs are bad it could cause this problem. – Thomas Taylor Jun 3 '14 at 2:12
6

The Non Profit stater pack code is all up on GitHub - you'll probably want to look at the Contacts and Org piece for Opportunity triggers:

If you have access to the PowerofUs Hub, that's a good resource for questions as well.

For other packages, the ISV can login to you org if you grant them access, and when they do, they'll see their code/debug in full in the logs...So I would start with the NPSP, and if that looks ok, move onto the other vendors and ask for support...

  • 2
    There are relevant triggers in both the Contacts & Orgs and Households packages. – Thomas Taylor Jun 3 '14 at 14:57
0

See BritishBoyinDC's answer. The source code has been moved into Github.

The source for that managed package appears to be in code.google.com.

Try checking the triggers in https://code.google.com/p/npsp/source/browse/#svn/contactsandorgs/tags/

You will need to find the version that matches your managed package. Assuming you have 2.0.2 you can find the triggers here.

  • 1
    The Google repo has been deprecated in favor of GitHub... – BritishBoyinDC Jun 2 '14 at 22:58
  • 1
    @BritishBoyinDC Ah, I did not know that. I was going off the Source code for all versions link from developer.salesforce.com. I'll contact them to see if the link can be updated to github :) – Daniel Ballinger Jun 2 '14 at 23:16

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.