Bugfix in triggerhandler
This commit is contained in:
@@ -89,6 +89,14 @@ public virtual inherited sharing class fflib_TriggerActionConfig
|
||||
return this.sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the SObjectType linked to the trigger action
|
||||
*/
|
||||
public SObjectType getSObjectType()
|
||||
{
|
||||
return this.sObjectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns TRUE if the trigger action should be executed in a dedicated Queueable context
|
||||
*/
|
||||
|
||||
@@ -107,7 +107,9 @@ public virtual with sharing class fflib_TriggerHandler
|
||||
fflib_UnitOfWork unitOfWork = new fflib_UnitOfWork();
|
||||
for (fflib_ITriggerActionConfig triggerActionConfig : configs)
|
||||
{
|
||||
if (isValidExecutionContext(ctx, triggerActionConfig) == false) continue;
|
||||
if (isValidExecutionContext(ctx, triggerActionConfig) == false
|
||||
||
|
||||
isValidSObjectType(triggerActionConfig, ctx) == false) continue;
|
||||
|
||||
fflib_ITriggerAction triggerAction = getTriggerActionInstance(triggerActionConfig);
|
||||
|
||||
@@ -130,6 +132,11 @@ public virtual with sharing class fflib_TriggerHandler
|
||||
return config.hasTriggerContext(ctx.getTriggerOperation());
|
||||
}
|
||||
|
||||
private Boolean isValidSObjectType(fflib_ITriggerActionConfig triggerActionConfig, fflib_ITriggerContext ctx)
|
||||
{
|
||||
return triggerActionConfig.getSObjectType() == ctx.getRecords().get(0).getSObjectType();
|
||||
}
|
||||
|
||||
private fflib_ITriggerAction getTriggerActionInstance(fflib_ITriggerActionConfig triggerActionConfig)
|
||||
{
|
||||
if (triggerActionConfig.isStateful()
|
||||
|
||||
+5
@@ -39,6 +39,11 @@ public interface fflib_ITriggerActionConfig
|
||||
*/
|
||||
Integer getSequence();
|
||||
|
||||
/**
|
||||
* @return Returns the SObjectType linked to the trigger action
|
||||
*/
|
||||
Schema.SObjectType getSObjectType();
|
||||
|
||||
/**
|
||||
* @param triggerOperation The Trigger operation to validate the configuration against.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user