You need to sign in to do that
Don't have an account?
jalexander
Update to my WHERE clause in an APEX Class
I have the following working code snippet but need to add a second condition to the WHERE clause..
Question #2: How do I test the SOQL part in the sandbox before sending the Change Set to production (the Developer Console)?
/* Get the QuoteLineItem children of this Quote record that meet the criteria defined in the WHERE clause */ List<XX_ORD1__Quote_Line_Item__c> quoteLineItems = [ SELECT Id, BSO_Template_V__c FROM XX_ORD1__Quote_Line_Item__c WHERE XX_ORD1__Parent_QLI__c = null AND XX_ORD1__Quote__c = :quoteId ];Question#1: How do I add an extra AND clause: XX_ORD1__QLI_Type__c NOT LIKE 'Termination' (this is from a picklist)?
Question #2: How do I test the SOQL part in the sandbox before sending the Change Set to production (the Developer Console)?
Question#1:
LIKE needs '%' for the extra characters at the beginning or/and at the end.
For the picklist values, there is only a specific syntax for the multi-picklist with includes like above.
Question #2:
You can test your query with the Developer Console (tab Query Editor) or the Workbench.
https://help.salesforce.com/articleView?id=code_dev_console_tab_query_editor.htm&type=5
Workbench: https://developer.salesforce.com/page/Workbench
Searching for records: https://developer.salesforce.com/page/File:Wb2_query.png
https://workbench.developerforce.com/login.php
All Answers
Error: Compile Error: Expecting 'IN' but was: 'LIKE' at line 25 column 43
i think following field is picklist XX_ORD1__QLI_Type__c picklist fields not supporting to the like opertor.
You can use includes instead of that.
like
XX_ORD1__QLI_Type__c includes ('AAA;BBB','CCC')
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Question#1:
LIKE needs '%' for the extra characters at the beginning or/and at the end.
For the picklist values, there is only a specific syntax for the multi-picklist with includes like above.
Question #2:
You can test your query with the Developer Console (tab Query Editor) or the Workbench.
https://help.salesforce.com/articleView?id=code_dev_console_tab_query_editor.htm&type=5
Workbench: https://developer.salesforce.com/page/Workbench
Searching for records: https://developer.salesforce.com/page/File:Wb2_query.png
https://workbench.developerforce.com/login.php