You need to sign in to do that
Don't have an account?

Attempt to de-reference a null object
Hi,
I have a PRM enabled org. I have an afterUpdate trigger on Opportunity. In the code, I am doing this -
Now when I do this
It works fine when I do this within Salesforce, but we have a quoting tool - QuoteWerks, which also updates opportunities. This tool throws a Null pointer exception - Attempt to de-reference a null object on this line -
I have a PRM enabled org. I have an afterUpdate trigger on Opportunity. In the code, I am doing this -
Code:
//get the opp fields
Set<Id> oppIds = new Set<Id>();
for (Opportunity opp : Trigger.new) {
oppIds.add(opp.Id);
}
Map<Id, Opportunity> opportunityMap = new Map<Id, Opportunity>(
[Select Id, partnerAccountId, isClosed, isWon, Partner_Amount__c,
closeDate from Opportunity where Id In :oppIds]);
Now when I do this
Code:
for (Opportunity o : Trigger.new) {
Opportunity opp = opportunityMap.get(o.Id);
if (opp.partnerAccountId != null) {
It works fine when I do this within Salesforce, but we have a quoting tool - QuoteWerks, which also updates opportunities. This tool throws a Null pointer exception - Attempt to de-reference a null object on this line -
opp.partnerAccountId != null
Any ideas why this would happen.
Thanks,
Rohit
Try adding some System.debug messages to figure out what Opportunities are being added to the Map object and then more debug messages to identify if any Opportunity is being retrieved when you get the Opportunity from the Map.
I hope this helps.
What is surprising is when I retrieve a list it works while Map does not.
Thanks,
Rohit