• Deepak Venkatesh 6
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi All, 
I am new to Salesforce, I am accessing sales force data trough another tool and writing a select query to pull out data for last two years but I am getting error and below is the query:

select  
Account.Name,
RecordType.Name,
Opportunity.Effective_Date__c
from 
Opportunity where 
CALENDAR_YEAR(Opportunity.Effective_Date__c)>=:(THIS_YEAR -:2) 

Please suggest, at any point of time, I need to pull 2 years data starting from Jan 1st like if am in November 2017, I need to pull data from Jan 2015. 

I get syntax error "Bind Variables Allowed in Apex Code" 
Thanks in advance !!!
Hi All, 
I am new to Salesforce, I am accessing sales force data trough another tool and writing a select query to pull out data for last two years but I am getting error and below is the query:

select  
Account.Name,
RecordType.Name,
Opportunity.Effective_Date__c
from 
Opportunity where 
CALENDAR_YEAR(Opportunity.Effective_Date__c)>=:(THIS_YEAR -:2) 

Please suggest, at any point of time, I need to pull 2 years data starting from Jan 1st like if am in November 2017, I need to pull data from Jan 2015. 

I get syntax error "Bind Variables Allowed in Apex Code" 
Thanks in advance !!!
Hi all,
 
In my application i require to fetch data for the year entered by user using SOQL query,
In SOQL i tried the below code:
Code:
date sampleDate=Date.today();
//assume user have entered 2003
Integer diff=sampleDate.year()-2003;
Contact_log__c[] contactLog=[Select a.Id from Contact_log__c a where  a.Last_Import_ModifiedDate__c =(THIS_YEAR-:diff) order by a.Sequence_Number__c desc limit 1];

 

but i get syntax error , Please guide me.

Thanks in advance


 
  • January 20, 2009
  • Like
  • 0