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
Rajat MahajanRajat Mahajan 

Urgent help on trigger on Custom object Account

Hey Guys, 

 

Could you please help me construct one bulk trigger ?

 

I am trying to achieve a requirement :

 

Before deletes on Account, we need the trigger to check if the Account has any opportunities on the Account. If the Account has opportunities, we need to prevent the deletion and move on to the next record.

 

Regards

Rajat

 

 

 

bob_buzzardbob_buzzard

Preventing deletions for just one record can be tricky.  How is the deletion happening?

Rajat MahajanRajat Mahajan

Thanks for taking out time to read this Bob.

Yea well,

 

The delete will happen through a script in Informatica. When that happens in bulk, the trigger should help us not delete the accounts which :

 

1. Have an Opportunity

2. Have status(custom text field) as 'A'

 

Do you think we can achieve this ?

 

Regards

Rajat

bob_buzzardbob_buzzard

Assuming that informatica is using the web services api, the default behaviour for that is to allow individual records to error out of a larger batch.  Is there a setting in the informatica side that allows you to confirm this?

 

If it is using the default, you should be able to add an error to the individual record which stops the deletion happening.  This is considered a failure though, so you might get retries happening.