Foundations Apex API Developer Reference

fferpcore.TriggerDataSource

global with sharing class TriggerDataSource extends DataSource

This fferpcore.DataSource is for use in triggers and is invoked with the list of fully populated records from the trigger. The runQuery() method returns an iterator that steps through all records passed in from the trigger. Consequently it does not provide an implementation of the requireField method.

This class extends fferpcore.DataSource

Methods

TriggerDataSource

global TriggerDataSource(List<SObject> records)

Input Parameters

Name Type Description
records List<SObject> A list of fully populated records, as found in Trigger.new or Trigger.old.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

/**
 * This example uses the Message Description and Declarative Extension system to send messages
 * about updates to the Sample__c custom object. It is assumed that the publishing product
 * 'SampleProduct' is registered to send messages to the 'Sample.Update' Message Type.
 */
trigger SampleTrigger on Sample__c (after insert, after update)
{
    // Prevent an infinite loop by not sending a message in response to a message.
    if (!fferpcore.MessagingSystemService.isInDelivery())
    {
        // Provide the new or updated records as a DataSource for message generation.
        fferpcore.DataSource dataSource = new fferpcore.TriggerDataSource(Trigger.New);

        // Send the messages
        fferpcore.MessagingSystemService.deliverLater('SampleProduct', 'Sample.Update', dataSource);
    }
}

requireLookupField

global override fferpcore.DataSource requireLookupField(SObjectField field)

Ask that this data source query the given lookup. This method will be called by the Declarative Publish framework or by custom message Nodes during the preparation phase of declarative message building.

Input Parameters

Name Type Description
field SObjectField The field representing the lookup

Return Value

A DataSource representing the target of the look up.

requireOneToManyField

global virtual override fferpcore.DataSource requireOneToManyField(BackReference backReference)

Implementation of DataSource.requireOneToManyField().
Ask that this data source query the given one to many (Master/Detail) relationship. This method will be called by the Declarative Publish framework or by custom message Nodes during the preparation phase of declarative message building.

Input Parameters

Name Type Description
backReference BackReference A description of the relationship as viewed from the defining "Many" Detail end.

Return Value

A DataSource representing the target of the lookup.

runQuery

global override Iterator<fferpcore.DataSource.Row> runQuery()

Implementation of DataSource.runQuery().
Load the data. This must only be performed on the top level DataSource, not any of the DataSources returned by the requireLookupField or requireOneToManyField methods. This method will be called by the Declarative Publish framework.

Return Value

An iterator of fferpcore.DataSource.Row objects containing the required data.

© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.