• Adil Aleem 17
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi All,

 

Here is my situation:

I have custom object with a trigger that updates a field in Contact. This trigger fires in insert, update & delete.

I also have a Contact trigger which updates this custom object (insert/delete) on certain conditions alone. The contact trigger also handles many other functionality, but each is executed only on certain condition.

The contact and custom object have master-child relationship. 1 contact can have many child custom objects.

 

On a particular condition, when a contact trigger insert or delete one of the child custom record, the recursion occurs which I want to stop.

To do this, I created a custom text field (source__c) in the custom object (custom__c) and updates the value of it (Ex: 'From Contact Trigger') in Contact trigger alone.

Now I want to exit from the Custom_Trigger without executing the rest of code when the custom__c.source__c == 'From Contact Trigger'

The break or continue statement wont work here. There is no exit() stmt. I also don't want to explicitly through error to the user since user.

 

I have developed a scheduled apex that does the same job as custom object trigger and run it once a day so the field value in contact updated.

So updating the contact field is taken care. But I want to avoid the exception which is preventing the custom record insert/delete during contact trigger.

 

Is there an elegant way to do this? Is there any method available in apex that substitute exit()?

 

Please help!

Thanks in advance!

Hi
Can anybody help me with Integrating Salesforce with Encompass or Calyx Point Mortgage Industry Loan Orgination System . need help to read and write data  into both the systems acrooss from Encompass into Salesforce and from Salesforce to Encompass
 
Regards
Krishna