• Vinay Temburnikar 7
  • 10 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 0


I made changes to a query in an apex class. From:

where A=x and B=true; To: where (A=x OR C=y) AND B=true

I thought this was simple enought to not warrant writing new apex test code, I had made the same change in a total of 5 instances in the apex class. And I was right, it showed 82% code coverage in the full sandbox after making these edits.

However, when I sent this change set containing only the single apex class to production, I'm getting a code coverage of 21% there. I text compared the test class in prod and the full sandbox, they are an exact match. 

I wonder what the problem is and why I'm getting this discrepency in code coverage. Any help would be much appreciated. 

Thanks in advance! 

Need a query that basically says

(ExposeCase = true OR CreatedByID = UserInfo.getUserId()) AND isClosed = false

which would be in the following syntax and sort of a combination of these:

soql += ' Where CreatedById = \'' + UserInfo.getUserId() + '\' OR Expose_Case__c = true';

soql += ' Where Expose_Case__c = true AND isClosed = false';

I am unable to figure out the syntax. I've tried the following 

soql += ' Where CreatedById = \'' + UserInfo.getUserId() + '\' OR Expose_Case__c = true' + 'AND isClosed = false';