Authored by Zishan Razzaq
Showing posts with label SOSL. Show all posts
Showing posts with label SOSL. Show all posts

Thursday, November 29, 2012

How to use 'NOT LIKE' in SALESFORCE SOQL

Hi everyone:
    Business Scenario:
        They would like something update where a field on the record is NOT LIKE "adviser." Or in simplest terms does not contain "Adviser".

Solution for developers in APEX:

APEX will not allow someone to write a simple query such as:
SELECT Name From ABC where id=:Ownerid and Name NOT Like '%adviser%';

So solution is simple:
SELECT NAME From ABC where id=:Ownerid and (NOT Name Like  '%adviser%');

If you are utilizing GROUP By statements here is an example of one:


 AggregateResult[] groupedResults = 
         [SELECT Ownerid,Count(Id) ce 
         FROM Opportunity Where 
         Withdrawn__c = True 
         AND StageName = 'Closed Won' 
         AND Withdrawal_Status__c ='Withdrawn' 
         AND Withdrawn_Date__c = THIS_MONTH  
         AND Ownerid=:id 
         AND (NOT Name Like '%COMP%')
         GROUP BY Ownerid];  

Hope this Helps.
Thanks
Zishan



Thursday, November 20, 2008

Tips and Tricks About AJAX TOOLS in Salesforce.com

Hi all:
Today, I want to give tips and tricks about AJAX TOOLS in salesforce.com. But you need a couple things first:
  • If you have an salesforce.com org set up then download the ajax toolkit .
  • Click on Get it Now.
  • Go to the process, it will ask where would you like to place it, using your developer account, company's or sandbox username and password.
  • Once all of the steps are done and executed onto the org you decided.
  • This will create an app onto your org called AJAX TOOLS. Look at Picture

  • The best place to run AJAX is in Mozilla Firefox (If you do not have Mozilla then download here). With IE it does not work properly.
  • Now once we are in AJAX, Click on Start Ajax Tools - This will open up a new window and first thing you will see is all of your S-Controls and Underneath that your Apex Classes, and Visual Force Pages.
  • You will see many icons on top going from Left to Right Across. See Picture Below
  • Save, Run, New, Backup and Config On the Left hand side of the Menu - Is used to save your S-Controls, Apex Classes
  • On the Right hand Side These are different set of menus that open up a new world.
  • Shell:
  1. You Can place your Javascript code to see if it runs correctly
  2. Can place in APEX Code, SOSL Statement or your SOQL statement
  3. To Make it run just hit enter...
  • Samples:
  1. Cool way to learn Javascript and correct SOQL Statements.
  • Explorer:
  1. This is the best tool of them all on this AJAX TOOLKIT.
  2. One can create queries and relationships just by selecting tables fields from the Parent Table.
  3. For example, Dropdown Account Where it states SObject.
  4. Next you will see all the fields come up PLUS all the relationship Tables that go along with the Account. AMAZING.
  5. You can do many things with the query statement you produce out of here.
  6. You can create your S-Control and then make the tweeqs that you need to make it work. All you have to do is click on Generate Sample. This will generate the code needed for your S-Control on that object. See Picture Below


I hope this help anyone out... Let me know...
Thanks
View my Other Blogs:
VisualForce Made Easy

Salesforce Data Migration Made Easy