function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Dynamic SOSL Syntax Help

I keep getting the following error when trying to create this query:


System.QueryException: expecting a right parentheses, found '('


Any Ideas? I've tried every way possible.  Thanks in advance!


public static String checkGCQuery = 'select Id from Guest_Card__c where Initial_Lead_Type__c = \'Independent Lead Source\' '
+ 'AND ((Move_In_Date__c != Null AND LastModifiedDate >= :system.Today().addDays(-30)) '
+ 'OR (Move_In_Date__c = Null AND LastModifiedDate >= :system.Today().addDays(-60)))';


Any reason why you're using Dynamic SOSL? There's nothing there that causes a need for it to be dynamic. When possible, I avoid dyanmic SOSL/SOQL like the plague.