• Srikant Swain 8
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I need to write a batch class monthly that will query all child records and calculates the percentage consumed from an amount field and creates a new record in a 3rd Object.
Example:- Object "Program" has multiple children "projects"(can have more than 200) with lookup relation and has a field "Amount". The parent "Program" object has a field  "Allocated Total Amount". I have to query all children and calculate the sum of the amount and take percentages like (Sum of Amount/ Allocated Total Amount * 100). After that, I have to create a record in another object "Summary Table" with Program Name, Start Date, and End Date from the Program Object and calculated the Percentage in a field.
I need to write a batch class monthly that will query all child records and calculates the percentage consumed from an amount field and creates a new record in a 3rd Object.
Example:- Object "Program" has multiple children "projects"(can have more than 200) with lookup relation and has a field "Amount". The parent "Program" object has a field  "Allocated Total Amount". I have to query all children and calculate the sum of the amount and take percentages like (Sum of Amount/ Allocated Total Amount * 100). After that, I have to create a record in another object "Summary Table" with Program Name, Start Date, and End Date from the Program Object and calculated the Percentage in a field.