• Pratibha Pandit 7
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I have a simple process which updates all child records when the parent is updated. The problem I'm having is that occassionally a child record will have some data that was entered prior to a validation rule being created - when the process runs this child record fails validation, and in turn, causes the process to fail - returning a pretty cryptic error to the user. Is there a way to gracefully handle errors like these in Process Builder?

I need to create a Trigger on a custom object that will update the OpportunitySplit records to reflect the Users and Splits inserted into a custom object.

 

My logic is:

 

Get the users and split percentages (3 total users), and the Opportuity Id, from the inserted record on the custom object

Select all existing OpportunityTeamMember records related to the Opportunity

Select all existing OpportunitySplit records related to the Opportunity

Delete all OpportunitySplit records for the given Opportunity except the Opportunity Owners OpportunitySplit record

Delete all OpportunityTeamMember records for the given Opportunity except the Opportunity Owners OpportunityTeamMember record.

Excecute a Database.Upsert that updates the Opportunity Owners TeamMemberRole to a specific value (DM Schedule Split Primary) and inserts new OpportunityTeamMember records for 2 other users.

This works fine

Execute a Database.Upsert that updates the Opportunity Owners SplitPercentage and inserts new OpportunitySplit records for the other 2 users. (The total of all 3 equals 100)

This throws an error:  FIELD_INTEGRITY_EXCEPTION, Can't update splits: percentages don't add up to 100.00%

 

What is the secret here?