• Florin W
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello Apex Masters!
 
I'm new on Apex and I'm trying to create a trigger that prevents Salesforce from saving child records.

Parent record: "Account"
Custom child record: "Budget" --> Fields: "Year"(picklist) and "Amount" (picklist, four values)

Conditions for saving related child records:

- Maximum of 3 "Budget" child records per related account and "Year" (e.g. "2016")
- Sum(Amount) of related "Budget" child records must be <= $500 per year

Can you help me with this?
It seems not to be working with validation rules.
Hello Apex Masters!
 
I'm new on Apex and I'm trying to create a trigger that prevents Salesforce from saving child records.

Parent record: "Account"
Custom child record: "Budget" --> Fields: "Year"(picklist) and "Amount" (picklist, four values)

Conditions for saving related child records:

- Maximum of 3 "Budget" child records per related account and "Year" (e.g. "2016")
- Sum(Amount) of related "Budget" child records must be <= $500 per year

Can you help me with this?
It seems not to be working with validation rules.