You need to sign in to do that
Don't have an account?

USING THIS_WEEK Filter in custom setting
Hi, I am trying to use THIS_WEEK date filter in my custom setting and trying to refrence it in my code. I am getting the below error:
System.TypeException: Invalid date: THIS_WEEK
Code snippet below:
PayCycleInformationWrapper payCycleInfoWrap=new PayCycleInformationWrapper(); List<cve__PaymentScheduleItem__c> psItemList=new List<cve__PaymentScheduleItem__c>(); Map<string,cve__PaymentScheduleItem__c> payFreqPSItemMap=new Map<string,cve__PaymentScheduleItem__c>(); WTW_Report_Parameters__c wtwReportParams = WTW_Report_Parameters__c.getInstance(UserInfo.getProfileId()); String payableTime=wtwReportParams.Payable__c; // place where i am storing THIS_WEEK as filter
Date payableDate=Date.valueOf(payableTime);
String payFrequency=wtwReportParams.Pay_Frequency__c; set<string> payFrequencySet=new set<string>(); payFrequencySet.add(payFrequency);
psItemList=[ Id FROM cve__PaymentScheduleItem__c where cve__PaymentSchedule__r.Name Like '%OnCycle%' and cve__payable__c=:payableDate and cve__paymentschedule__r.Name ];
System.TypeException: Invalid date: THIS_WEEK
Code snippet below:
PayCycleInformationWrapper payCycleInfoWrap=new PayCycleInformationWrapper(); List<cve__PaymentScheduleItem__c> psItemList=new List<cve__PaymentScheduleItem__c>(); Map<string,cve__PaymentScheduleItem__c> payFreqPSItemMap=new Map<string,cve__PaymentScheduleItem__c>(); WTW_Report_Parameters__c wtwReportParams = WTW_Report_Parameters__c.getInstance(UserInfo.getProfileId()); String payableTime=wtwReportParams.Payable__c; // place where i am storing THIS_WEEK as filter
Date payableDate=Date.valueOf(payableTime);
String payFrequency=wtwReportParams.Pay_Frequency__c; set<string> payFrequencySet=new set<string>(); payFrequencySet.add(payFrequency);
psItemList=[ Id FROM cve__PaymentScheduleItem__c where cve__PaymentSchedule__r.Name Like '%OnCycle%' and cve__payable__c=:payableDate and cve__paymentschedule__r.Name ];
Date payableDate=Date.valueOf(payableTime);