Filtering costplans
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 09:03 AM
I had a requirement to add filter conditions in cost plan related list on Project, if we are in FY2024 then we need to show start fiscal year is FY2024.example
1.we are in FY2025(ex:2024/oct/01 to 2025/sep/31) then need to display start fiscal year is FY2025 records,
2. if we are in FY2026(ex:2025/oct/01 to 2026/sep/31) then need to display start fiscal year is FY2026records,
i need this process for every year
we need to do automat this process. may i know how to achive this..
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2023 12:06 AM - edited 10-21-2023 12:11 AM
Hi @VSN,
You have to write before query business rule in pm_project table and change field names and table names as per your requirements.
(function executeRule(current, previous) {
var nowdate= new GlideDate();//current year
var currentYear = parseInt(nowdate.getYear());
var currentMonth = parseInt(nowdate.getMonth());
var fiscalYear = currentYear;
if (currentMonth >= 4){//checking if we are in next financial year based on month
fiscalYear = currentYear + 1;
}
current.addQuery('cost_plan.start_fiscal_year', '=', 'FY' + fiscalYear);//replace cost plan with you related list
})(current, previous);
Thanks,
Anand