简体   繁体   中英

CRM 2011 Custom Workflow - Get the current fiscal year

I have a custom CRM 2011 workflow which needs to know the current fiscal year. Currently I am just passing in an integer value (2012) for the condition operator, see below:

complianceRecordCondition.AttributeName = "new_complianceStartDate";
complianceRecordCondition.Operator = ConditionOperator.InFiscalPeriod;
complianceRecordCondition.Values.Add(2012);

What I need to do is, instead of adding 2012 in the values, I need to calculate/get the current fiscal year somehow and place that in the values.

Can anyone explain how I go about doing this?

Jack

I havn't used the fiscal parts myself so I'm a little unfamiliar, but have you seen these other conditional operators?

public enum ConditionOperator
{        
    ...
    ThisFiscalYear = 58,        
    ThisFiscalPeriod = 59,        
    NextFiscalYear = 60,        
    NextFiscalPeriod = 61,        
    LastFiscalYear = 62,        
    LastFiscalPeriod = 63,        
    LastXFiscalYears = 64,        
    LastXFiscalPeriods = 65,        
    NextXFiscalYears = 66,        
    NextXFiscalPeriods = 67,        
    InFiscalYear = 68,        
    InFiscalPeriod = 69,        
    InFiscalPeriodAndYear = 70,        
    InOrBeforeFiscalPeriodAndYear = 71,        
    InOrAfterFiscalPeriodAndYear = 72,
    ...
}

They look closer to what you are trying to achieve, in particular ThisFiscalYear .

I would expect the filter to look a little more like this:

complianceRecordCondition.AttributeName = "intellic_complianceStartDate";   
complianceRecordCondition.Operator = ConditionOperator.ThisFiscalYear;

for getting fiscal year in according to crm fiscal year setting you have to fallow these steps.

  1. Retrieve fiscal year start date from the organization entity.
  2. Then calculate the current fiscal year. You can get code in this link

    Get Current fiscal year in crm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM