You need to sign in to do that
Don't have an account?
Rajesh Singh 88
Trigger to Auto Increment the field to the required Financial Quarter
In my company the Financial Year starts from April - March. My requirement is When the Period__c ( picklist ) is updated to Quarter 1 then the Financial_Period__c is updated to FY21 - Q1.
The Financial_Period__c needs to be incremented based up on the Financial Year.
I am new to Apex , can someone please help me in this.
Period__c picklist values :
Quarter 1
Quarter 2
Quarter 3
Quarter 4
Example for FY21:
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY21 - Q2
If the Period__c is updated to Quarter 4 the Financial_Period__c is updated to FY21 - Q4
Similarly for FY22 :
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY22 - Q2
Similarly for FY24 :
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY24 - Q2
Thanks!
The Financial_Period__c needs to be incremented based up on the Financial Year.
I am new to Apex , can someone please help me in this.
Period__c picklist values :
Quarter 1
Quarter 2
Quarter 3
Quarter 4
Example for FY21:
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY21 - Q2
If the Period__c is updated to Quarter 4 the Financial_Period__c is updated to FY21 - Q4
Similarly for FY22 :
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY22 - Q2
Similarly for FY24 :
If the Period__c is updated to Quarter 2 the Financial_Period__c is updated to FY24 - Q2
Thanks!
Answer:
You have not mentioned on which Sobject these two fields(Period__c and Financial_Period__c) are present. I assumed these two fields are on the Opportunity object. I have written trigger for your mentioned requirement
Trigger: Trigger Handler:
I hope you find the above solution helpful. If it does, please mark it as Best Answer to help others too.
Thanks and Regards,
Suraj Tripathi