You need to sign in to do that
Don't have an account?
System.QueryException: null:
Hi All,
I m getting below error while updating Opportunity.
System.QueryException: null:
When i query in debug log its works fine, but when i run the Query in class is gives me above exception.
Select SplitPercentage, SplitOwnerId, SplitNote, SplitAmount, OpportunityId, Id From OpportunitySplit where OpportunityId!=null and OpportunityId IN('006Z0000007XSSDSSD') limit 50000
So any one has any idea where i am going wrong.
Thanks
Shailu
Michael J. Moore
Director, Applications Developer
QuinStreet Inc.
950 Tower Lane, 6th Floor
Foster City, CA 94404
650.578.7657
mmoore@quinstreet.com
All Answers
Hi,
Please provide full code, any way there may be following problem in code-
I tried following code and its work (replace Opportunity id with your Opportunity id)-
List<OpportunitySplit> ols = [select SplitPercentage, SplitOwnerId, SplitNote, SplitAmount, OpportunityId, Id from OpportunitySplit where (OpportunityId != null and OpportunityId IN ('0069000000DAqGQ')) limit 50000];
- Make sure that 006Z0000007XSSDSSD exists.
-its possible that this qurey does not return any record and you are referencing list ols anywhere in code and do not checking null pointer exception, so check null pointer exception as if(!ols.isEmpty()){}
/**if this post helps you, please throw a kudos by clicking star**/
Thanks,
Grazitti
you can use:
List<OpportunitySplit> oprList = [Select SplitPercentage, SplitOwnerId, SplitNote, SplitAmount, OpportunityId, Id From OpportunitySplit where OpportunityId!=null and OpportunityId = :'006Z0000007XSSDSSD' limit 50000];
Use it by null check like:
if(oprList<>null && oprList.size()>0 ){
}
Thanks for your Solution Guys..
But the problem is bit different. i m tying to query to OpportunitySplit record which is associated with selected opportunity. If Opportunity stage is close won than it gives me above error and if stage is anything it allows me to save the record.
So Do you have any idea about OpportunitySplit ..?
Hi,
Please paste full code so that we can understand your problem clearly and can provide an optimised solution.
OpportunitySplits-
" Opportunity Splits lets user with appropriate access rights splits credit for Opportunity among members (Opportunity Team)".
Revenevue spits: this split provide credits to team member who are directly responsible for revenue.
Overlay spits: this split provide credits to team member who are indirectly responsible for revenue.
Please check :
1. Any validation rule, Workflow or Trigger on Opportunity at stage closed won.
2. Debug exception in code.
Thanks,
www.grazitti.com
Any solution for this, I am having the same problem on code that used to work fine. It's in opportunity controller extension.
I am running into the same thing. I have the following query within some logic in the Opportunity "after insert" trigger, where the clearUserSalesTeamOpps is a List that contains a single valid Opportunity ID:
List<OpportunitySplit> userSalesTeamSplits = [SELECT Id, SplitOwnerId, SplitNote, SplitPercentage, OpportunityId FROM OpportunitySplit WHERE OpportunityId IN :clearUserSalesTeamOpps];
This used to work fine until recently but now I get the following error:
EXCEPTION_THROWN|[339]|System.QueryException: null
It looks to me like there is a query exception but the message in the query exception is null. I don't think it is saying that any of my values/variables are null because that would be a different error message, plus the only variable I have is the clearUserSalesTeamOpps List and I verified that it has a value in it by writing to System.debug just prior to the line that throws the exception.
Michael J. Moore
Director, Applications Developer
QuinStreet Inc.
950 Tower Lane, 6th Floor
Foster City, CA 94404
650.578.7657
mmoore@quinstreet.com
I've winnowed this down to a minimal test case that fails with API < 28.0
compile with SalesForce.com API v18.
Run via Execute Anonymous:
Throws exception:
Exception is thrown with SalesForce.com API in (v18, v19, v27)
Does not throw exception with SalesForce.com API in (v28, v29)