Skip to content

MetadataTriggerQueryService

codefriar edited this page Oct 5, 2023 · 2 revisions

STATUS: ACTIVE

Class encapsulates the querying of Metadata_Driven_Trigger__mdt records on behalf of the MetadataTriggerHandlerClass class. It is not intended to be used directly by developers.

Constructors

public MetadataTriggerQueryService(String objectTypeName)

Constructor for trigger query service

Parameters

Param Description
objectTypeName String The object Type name

Fields

private objTypeString

Initialize objectTypeName as an empty string to avoid null errors


Methods

public List getMetadataTriggers()

SUPPRESSWARNINGS

This query finds an ordered list trigger handler classes to execute. It ignores any classes that are marked as disabled.
Note: It will exclude any triggerHandler metadata records for which the user's email address is found in a related disabled_for__mdt record.
Admins and Developers can selectively disable trigger handlers for all or selected individuals without deploying.

Returns

Type Description
List<Metadata_Driven_Trigger__mdt> List<Metadata_Driven_Trigger__mdt>

public static String getSObjectType(List<SObject> triggerNew, List<SObject> triggerOld)

This determines the active sObject type by describing the first record in the trigger New / Old list

Parameters

Param Description
triggerNew List The trigger.new list
triggerOld List The trigger.old list

Returns

Type Description
String String the ObjectType name

Throws

Exception Description
MetadataTriggerFrameworkException when both triggerNew and triggerOld are null

Clone this wiki locally