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
podgercor1.3917890117104897E12podgercor1.3917890117104897E12 

Fiscal Quarter in a trigger

Hi, 

 I am trying to create a trigger that will update a field on the Account based on an Event being marked as complete - the problem i have is that I only want the trigger to fire when the Activity Date is in the Current Fiscal Quarter. I have tried using 
ActivityDate == FISCAL_QUARTER() 
and THIS_FISCAL_QUARTER()
but neither has worked ... any ideas on how I can achieve this ?
thanks
Best Answer chosen by podgercor1.3917890117104897E12
KiranSFDCKiranSFDC
Date closeDate = [Select EndDate From Period Where type = 'Quarter' and StartDate = THIS_FISCAL_QUARTER].EndDate;

All Answers

KiranSFDCKiranSFDC
Date closeDate = [Select EndDate From Period Where type = 'Quarter' and StartDate = THIS_FISCAL_QUARTER].EndDate;
This was selected as the best answer
VikashVikash (Salesforce Developers) 
Hi,

The ActivityDate is, if the Event IsAllDayEvent flag is set to true (indicating that it is an all day Event), then the Event due date information is contained in the ActivityDate field. This field is a date field with a timestamp that is always set to midnight in the Coordinated Universal Time (UTC) time zone. The timestamp is not relevant, and you should not attempt to alter it to account for any time zone differences. Label is Due Date Only.
This field is required in version 12.0 and earlier if the IsAllDayEvent flag is set to true.
The value for this field and StartDateTime must match, or one of them must be null.

The data type for this is date and you are providing FISCAL_QUARTER() which returns a number representing the fiscal quarter of a date field.Hence try and change the function to a funtion which returns date.

Thanks
Vikash_SFDC