+ Start a Discussion
Anirudh Sharma 5Anirudh Sharma 5 

I keep getting this error when deploying

I am trying to deploy work flow email,alerts,field updates via change sets and I keep getting the below error when the tests are runned in the change set. And when I run the test indivudally it is passed. 

System.QueryException: List has no rows for assignment to SObject 
Stack Trace: Class.AP_CreatePanelReviewersTest.createApplication1: line 105, column 1

I have created the records according to the SOQL criteria too. And I have also disaabled parallel testing. 

Please help me in this
KevinPKevinP
Your test (CreateApplication1) is querying for data that doesn't exist in your org. 

Typically that means, your test is assuming data exists, without creating it yourself.
Temoc MunozTemoc Munoz
Make sure your code is handling SOQL queries correctly:
 
// I assume this is your case:
YourCustomOrStandardObject obj = [SELECT id FROM YourCustomOrStandardObject ];

// Instead, try to code like this for best practice:
List<YourCustomOrStandardObject>obj = [SELECT id FROM YourCustomOrStandardObject ];