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
KlemencKlemenc 

Select statement correct?

Hello,

I'm pretty new to force.com. I've tried to deploy this (among other code) into production, which failed. Within eclipse and the sandbox there were no complaints. I wonder if this coding is correct or not:

 

Contact[] contacts = [select Id, Birthdate,Email, FirstName, LastName, Salutation from Contact
        where DAY_IN_MONTH(Birthdate) =: (Date.today().day()) and 
        CALENDAR_MONTH(Birthdate) =: (Date.today().month())];

 

Thanks regards

 

JimRaeJimRae
Has your production Org been upgraded to Spring 10?  Those new date methods are only available in the Spring 10 release.  I would experience the same result, I could run that query in my sandbox (which has been upgraded) but it would fail in production.
KlemencKlemenc

yep. In fact, we don't have version spring '10 in production!

you helped a lot!

Thanks

Hans M. Klemenc

KlemencKlemenc

Hello Jim,

the code, which worked fine a few days ago in the sandbox,  doesn't work today:

 

              Contact[] contacts = [select Id, Birthdate,Email, FirstName, LastName, KON_Aktionen__c, HasOptedOutOfEmail,  Anrede_Brief__c, Salutation from Contact
        where DAY_IN_MONTH(Birthdate) =: (Date.today().day()) and 
        CALENDAR_MONTH(Birthdate) =: (Date.today().month())];

 

It seems that the compiler in eclipse doesn't accept the new date-functions today. But why all at once? Has anything changed within the sandbox? (we already had the spring version running)

Thanks Regards

Hans

 

 

JimRaeJimRae

I don't think that Eclipse supports the version 18 API yet, which is why it wouldn't work with Eclipse.  Does it work if you execute an anonymous statement via the system log?  That is how I was testing.  Now, my production org is updated, and the same statement works in both sandbox and production.