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

How to get current fiscal year
HI every one,
How to get current fiscal year into a variable. Is there any method to read current fiscal year. I know how to write soql queries based on fiscal year. But how to get the value of current fiscal year into a variable.
Please help me.
Thanks,
Naresh
Integer FiscalYearStartMonth = [select FiscalYearStartMonth from Organization where id=:Userinfo.getOrganizationId()].FiscalYearStartMonth;
e.g. get your organization id from Userinfo, and query th information about your organization. Based on the current date and the FYStartmonth, you can determine what year you're in.
If that's not what you're looking for, I don't understand your question. Best, Steve.
All Answers
Integer FiscalYearStartMonth = [select FiscalYearStartMonth from Organization where id=:Userinfo.getOrganizationId()].FiscalYearStartMonth;
e.g. get your organization id from Userinfo, and query th information about your organization. Based on the current date and the FYStartmonth, you can determine what year you're in.
If that's not what you're looking for, I don't understand your question. Best, Steve.
HI Steve ,
thanks for the reply. But my requirement is, I want to assign the current fiscal year to a variable.
with the above code I will get current year. But how to get current fiscal year. Need more clarification please let me know.
Thanks,
Naresh
Ok...
Today is Feb 8th.
If your Fiscal year starts on Jan 1, what fiscal year are you now in?
If your Fiscal Year Start Month is February, what fiscal year are you now in?
If your Fiscal Year Start Month is March, what fiscal year are you now in?
Given todays date (from Date.today()) , and the starting month for your organizations fiscal year (from my previous code), you can figure out for yourself what fiscal year you are in and assign it to a variable.
Best, Steve.
HI Steve,
Thanks again for the reply. What if I want to make a package. Fiscal year is different for different organizations. How can I make a managed package.
Thanks,
Naresh B
You're packaging up Apex code. You put the logic in the Apex. Where are you confused?
Perhaps someone else can help you better than I
Best, Steve.
If you have one fisical year in your org.
Fiscal_Year__c year = [Select name from Fiscal_Year__c ];
Simillarly modify in query for having more fisical years.