Expected Behavior
If the parameters for an apex action are generic 'List', calling 'getSObjectType' on those parameters should return the records' SObject type.
Actual Behavior
If any entry criteria is set, calling getSObjectType returns null.
Steps to Reproduce the Problem
- Create an apex trigger action where the parameters are generic 'List' and entry criteria is blank.
- calling 'getSObjectType' on triggerNew returns the SObjectType as expected
- Add any entry criteria to the action
- calling getSObjectType now returns null
Specifications
- Version: 0.3.3
- Platform: Developer Edition
Simple Trigger Action Class to Replicate
public with sharing class DynamicSObjectTriggerAction implements TriggerAction.BeforeUpdate {
public void beforeUpdate(List<SObject> triggerNew, List<SObject> triggerOld) {
Schema.SObjectType sobjectType = triggerNew.getSObjectType();
// 'sobjectType' will be 'null' if any filter criteria is specified
System.debug('SObjectType from triggerNew: ' + sobjectType);
}
}
The Trigger Record Subclass to Replicate
global class AccountTriggerRecord extends TriggerRecord {
global Account record {
get {
return (Account) this.newSObject;
}
}
global Account recordPrior {
get {
return (Account) this.oldSObject;
}
}
}