Sometimes we need “NOT LIKE” operator in SOQL.
But SOQL will not allow someone to write simple query using “Not Like” operator such as:
SELECT Name From Account Where Name Not Like '%Test%';
So, here is the solution:
SELECT Name From Account Where Not Name Like '%Test%';
If you are using “GROUP By” clause with “Not Like” operator, here is an example:
SELECT Name From Account Where Not Name Like '%Test%' Group By Name;
Go to Setup – App Setup – Customize – Standard Object – Fields – Picklist or Multi-select Picklist Field
Go to Setup – App Setup – Create – Object – Fields – Picklist or Multi-select Picklist Field
- Click Reorder button on the Picklist Field under the Picklist Values Section.
- There will be a checkbox – “Sort values alphabetically. Values will be displayed alphabetically everywhere.”
- Check on it and then click Save.
- And now you can find Picklist or Multi-select Picklist Field values are in alphabetical order.
Salesforce lookup auto complete is a simple feature, which help a lot for daily works, but many of us may not aware about this feature. In this article, I will demonstrate how enable auto complete feature.
Steps to enable Lookup Auto Complete feature.
Go to Setup | App Setup | Customize | Search | Search Settings.
Scroll down to Lookup Settings and look for objects that you need enable for auto-completion then check Lookup Auto-Completion for the objects. Here in below snapshot I’ve enable lookup auto-complete for Account object.
Here is a snapshot of contact entry page, before enable lookup auto completion for Account object, when user type in Account name field, nothing show up. Here Contact is the child object of Account parent object.
After enable lookup auto completion in Account object, when user type a character in Account name field, it will show recent record from parent object Account.
- By default this feature is not enable, admin have to manually enable objects for auto-completion.
- When a lookup field created, the parent object (not child object) need to enable for auto-lookup.
- It will catch character in a word start with, and is case-insensitive.
- It only work for both Master-Detail and Lookup relationship, not for text field or other.
- It displays suggestions from My Recent Items list (including in recent tab and list view) as you type.
<apex:page controller="yourCustomcontroller" readonly="true">
Please note using
readonly="true" in Visualforce page, can increase Query Rows & Collection size:
- Query Rows limits increased from 50001 to 1 million rows.
- Collection size limits increased from 1001 to 10000.
Test.isRunningTest() is used to define whether the code is executed by test class.
Here is an example: