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
adarsh johnadarsh john 

Apex code for the scenario

Hello All,
I am new to Apex Development.
I have a scenario where i dont know how to write the code for the same.

We have 4 different objects
1)Accounts
2)departments
3)sub-departments
4)Wallet

Account always have a department assigned to it. Each department have different sub-departments.

Our system has a custom Wallet object, where the users can go and fill the spendable potential in that Wallet.
So the Users will fill out the potential of each sub department in the department. So the remaining Potential of each sub department will be found out by the Code which is already exists in system.

Customer is also filling a threshold value for the remaining potential in the custom metadata type. Based on that remaining potential, we need to classify the remaining potential as High,Low or Medium.

Now the scenario is we need to find out the total "Remaining potential" of that department.

As we have a lot of records for the same, I am planning to write a batch class to do the same. Could some one help me here to write the code for this.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Adarsh,

Can you provide the code what you have tried so far then only community will help you to proceed further.

Refer the below links will help you to learn about apex.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm
https://trailhead.salesforce.com/users/ehrenchris/trailmixes/apex-for-beginners

Thanks!!