Skip to main content
deleted 22 characters in body
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

@Mohith Shrivastava, I have tried yourMohith's solution, but in after delete trigger, it does not allow to update MasterRecord as its part of the merge operation which is currently in progress.

To overcome this, I created a static SET with master record ids in after delete trigger, and wrote a before update trigger, which checks if the Static SET contains the record id, then it set's the flag to TRUE for the record.

And it worked fine, but another problem was, in merge operation, the workflow does not fire for Master Record, so the flag was not reset, it remains flagged.

To overcome this, I wrote another before update trigger method, which will reset the flag always if its TRUE and not in Static Map.

In this case, the record will be flagged as ByPassValidation after merge, but as soon as user tries to update it, it will reset the flag in before trigger, and all validation rules will be applicable as in regular process.

@Mohith Shrivastava, I have tried your solution, but in after delete trigger, it does not allow to update MasterRecord as its part of the merge operation which is currently in progress.

To overcome this, I created a static SET with master record ids in after delete trigger, and wrote a before update trigger, which checks if the Static SET contains the record id, then it set's the flag to TRUE for the record.

And it worked fine, but another problem was, in merge operation, the workflow does not fire for Master Record, so the flag was not reset, it remains flagged.

To overcome this, I wrote another before update trigger method, which will reset the flag always if its TRUE and not in Static Map.

In this case, the record will be flagged as ByPassValidation after merge, but as soon as user tries to update it, it will reset the flag in before trigger, and all validation rules will be applicable as in regular process.

I tried Mohith's solution, but in after delete trigger, it does not allow to update MasterRecord as its part of the merge operation which is currently in progress.

To overcome this, I created a static SET with master record ids in after delete trigger, and wrote a before update trigger, which checks if the Static SET contains the record id, then it set's the flag to TRUE for the record.

And it worked fine, but another problem was, in merge operation, the workflow does not fire for Master Record, so the flag was not reset, it remains flagged.

To overcome this, I wrote another before update trigger method, which will reset the flag always if its TRUE and not in Static Map.

In this case, the record will be flagged as ByPassValidation after merge, but as soon as user tries to update it, it will reset the flag in before trigger, and all validation rules will be applicable as in regular process.

Source Link

@Mohith Shrivastava, I have tried your solution, but in after delete trigger, it does not allow to update MasterRecord as its part of the merge operation which is currently in progress.

To overcome this, I created a static SET with master record ids in after delete trigger, and wrote a before update trigger, which checks if the Static SET contains the record id, then it set's the flag to TRUE for the record.

And it worked fine, but another problem was, in merge operation, the workflow does not fire for Master Record, so the flag was not reset, it remains flagged.

To overcome this, I wrote another before update trigger method, which will reset the flag always if its TRUE and not in Static Map.

In this case, the record will be flagged as ByPassValidation after merge, but as soon as user tries to update it, it will reset the flag in before trigger, and all validation rules will be applicable as in regular process.