Contains the information and methods necessary to enable a subscription to handle an incoming message and update records accordingly. The data is transformed (Marshalled) into a format suitable for the subscribing product using Mappings. You can extend mappings to carry out complex operations on records before the final version of the records are produced.
Creates a LookupRecordTypeMapping that locates a record belonging to the given SObjectType where the value on the given lookup field matches the value at the given message key. The value on the result field of the record is in turn used to locate a matching record type for the given record type SObjectType, which is subsequently applied to the record.
Input Parameters
Name
Type
Description
messageKey
List<String>
The key within the message where the lookup value is located.
lookupObjectType
SObjectType
The SObjectType on which to locate a record.
lookupField
SObjectField
The SObjectField used to locate the record.
resultField
SObjectField
The SObjectField in which the record type name is located.
recordTypeObjectType
SObjectType
The SObjectType of the record type.
Return Value
A mapping that can be used in a SubscriptionDescriber.
global static fferpcore.SubscriptionDescription.Mapping createDataTransformationRecordTypeMapping(List<List<String>> messageKeys, Id transformTableId, SObjectType objectType)
Creates a DataTransformationRecordTypeMapping that extracts the data at the specified keys within the message, transforms it using the specified transformation table, and finally applies the record type with the matching name for the given SObjectType.
Input Parameters
Name
Type
Description
messageKeys
List<List<String>>
The keys within the message where the data is located.
transformTableId
Id
The ID of the transformation table.
objectType
SObjectType
The SObjectType of the record type.
Return Value
A mapping that can be used in a SubscriptionDescriber.
global static fferpcore.SubscriptionDescription.Mapping createRecordTypeMapping(List<String> messageKey, SObjectType objectType)
Creates a RecordTypeMapping that applies a record type for the given SObjectType with the name matching the data at the specified key within the message.
Input Parameters
Name
Type
Description
messageKey
List<String>
The key within the message where the record type name is located.
objectType
SObjectType
The SObjectType of the record type.
Return Value
A mapping that can be used in a SubscriptionDescriber.
global static fferpcore.SubscriptionDescription.Mapping createDataTransformationLookupMapping(SObjectField targetField, List<List<String>> messageKeys, Id transformTableId, SObjectType relatedObjectType)
Create a DataTransformationLookupMapping that can take 1 or 2 message keys to transform using the DataTransformationTable designated by the transformTableId. The result from the transformation is then used to lookup a record using the designated name field on a related object. The Id is then applied to the targetField.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the lookup.
messageKeys
List<List<String>>
A list of string lists that correspond to the keys in the message.
transformTableId
Id
The Id for the DataTransformationTable that should be used to perform the transformation.
relatedObjectType
SObjectType
The type of the related SObject on which to lookup the Id.
Return Value
A mapping that can be used in a SubscriptionDescriber.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//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
global static fferpcore.SubscriptionDescription.Mapping createDataTransformationLookupMapping(SObjectField targetField, List<List<String>> messageKeys, Id transformTableId, SObjectType relatedObjectType, SObjectField relatedLookupField, SObjectField relatedResultField)
Create a DataTransformationLookupMapping that can take 1 or 2 message keys to transform using the DataTransformationTable designated by the transformTableId. The result from the transformation is then used to lookup a record using the designated relatedLookupField field on a related object. The contents of relatedResultField is then applied to the targetField.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the lookup.
messageKeys
List<List<String>>
A list of string lists that correspond to the keys in the message.
transformTableId
Id
The Id for the DataTransformationTable that should be used to perform the transformation.
relatedObjectType
SObjectType
The type of the related SObject on which to lookup the Id.
relatedLookupField
SObjectField
The field on the related object to lookup with data from the message key.
relatedResultField
SObjectField
The field that contains the data that should be applied to the target field.
Return Value
A mapping that can be used in a SubscriptionDescriber.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//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
//Take the JobTitle from the message, do a transformation to convert it to a role, then look up the role using the role name, and put the primary area on the resource
global static fferpcore.SubscriptionDescription.Mapping createDataTransformationMapping(SObjectField targetField, List<List<String>> messageKeys, Id transformTableId)
Create a TransformationMapping that can take 1 or 2 message keys to transform using the DataTransformationTable designated by the transformTableId. The result from the transformation is then applied to the target field on the target object.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the data transformation.
messageKeys
List<List<String>>
A list of string lists that correspond to the keys in the message.
transformTableId
Id
The Id for the DataTransformationTable that should be used to perform the transformation.
Return Value
A mapping that can be used in a SubscriptionDescriber.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//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
global static fferpcore.SubscriptionDescription.Mapping createLookupMapping(SObjectField targetField, List<String> messageKey, SObjectType relatedObjectType)
Create a LookupMapping that takes a message key which is used to lookup a record using the designated name field on a related object. The id of the related record is then applied to the targetField.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the lookup.
messageKey
List<String>
A list of strings that correspond to the key in the message.
relatedObjectType
SObjectType
The type of the related SObject on which to lookup the Id.
Return Value
A mapping that can be used in a SubscriptionDescriber.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//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
Create a LookupMapping that takes a message key which is used to lookup a record using the designated relatedLookupField field on a related object. The contents of relatedResultField is then applied to the targetField.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the lookup.
messageKey
List<String>
A list of strings that correspond to the key in the message.
relatedObjectType
SObjectType
The type of the related SObject on which to lookup the Id.
relatedLookupField
SObjectField
The field on the related object to lookup with data from the message key.
relatedResultField
SObjectField
The field that contains the data that should be applied to the target field.
Return Value
A mapping that can be used in a SubscriptionDescriber.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//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
Create a lookup mapping that uses multiple message keys to locate a record on a related object using the specified lookup fields. The contents of the specified result field is applied to the target field.
Input Parameters
Name
Type
Description
targetField
SObjectField
The field that should be populated with the result of the lookup.
messageKeys
List<List<String>>
A list of string lists that correspond to the keys in the message.
relatedObjectType
SObjectType
The type of the related SObject on which to lookup the ID.
relatedLookupFields
List<SObjectField>
The fields on the related object to lookup with data from the message keys.
relatedResultField
SObjectField
The field that contains the data that should be applied to the target field.
Return Value
A mapping that can be used in a SubscriptionDescriber.
global inherited sharing abstract class ApplyMappingRequest
A request to apply a mapping to a record. A fferpcore.SubscriptionDescription.Mapping object accepts an ApplyMappingRequest in the performImmediateActions method. The request contains the record to be updated as well as the message.
When messages are sent in bulk, ApplyMappingRequests are grouped by record before being provided to the mapping. For example, a mapping might handle two messages for record A, then one message for record B, then five messages for record C. This method can be used to find if we have moved on to a different record. When messages are sent synchronously they are handled one at a time and this method will always return true.
Return Value
True if this is the first request for the given record.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//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
global abstract void respondError(fferpcore.ErpErrorBody error)
Marks the message with an error. If the error logging is set to MessagingSettingsService.LOGGING_LEVEL_ERROR or MessagingSettingsService.LOGGING_LEVEL_ALL, the message is marked with an error that you can investigate. After this method is called, processing on the record will be stopped and changes will not be saved. All other messages for that record will be marked in error.
global virtual Set<String> getAdditionalSelections()
These selections are passed to the fferpcore.LinkingCorrelationStrategy to be used when querying the SObject Records. Names must be fully qualified. The selections can include relationship selections and subselects, but beware of LIMITs when doing this. The default implementation returns null.
Return Value
Set of any additional selections required by the mapping.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//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
global abstract void performImmediateActions(fferpcore.SubscriptionDescription.ApplyMappingRequest request)
Applies information from the fferpcore.Message to the Record. This is called before performBulkActions. This method must be overridden by any class that extends SubscriptionDescription.Mapping.
Called after all messages have been processed, to allow the Mapping to perform any bulk actions. An exception thrown here will result in all Messages and changes being rejected. If you can handle errors at the record level or message level using the respondError() method on a stored ApplyMappingRequest then do so as this will result in less damage to other records and messages. The default implementation of this method does nothing.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//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
global virtual void disableFields(Set<String> fieldNames)
Allows mappings to be superseded by providing the set of fields that later mappings write to. A Mapping must not write to a field if it was provided in this set.
Input Parameters
Name
Type
Description
fieldNames
Set<String>
The target fields that are written by later mappings.
global FieldMapping(SObjectField targetField, String messageKey)
Constructs a FieldMapping that populates targetField with data from the part of the message accessed by messageKey. This method is a convenience for calling: new SubscriptionDescription.FieldMapping(targetField, new List<String>{messageKey}).
global override Set<String> getAdditionalSelections()
Implementation of SubscriptionDescription.Mapping.getAdditionalSelections(). This method is invoked by the fferpcore.SubscriptionDescription and should not be called directly.
Return Value
Any fields that will be updated and therefore need to be queried.
global override void performImmediateActions(fferpcore.SubscriptionDescription.ApplyMappingRequest request)
Implementation of SubscriptionDescription.Mapping.performImmediateActions(SubscriptionDescription.ApplyMappingRequest request). This method is invoked by the fferpcore.SubscriptionDescription and should not be called directly. Perform any mapping functionality on the given request only.
Implementation of SubscriptionDescription.Mapping.getTargetFields(). This method is invoked by the SubscriptionDescriptionController and should not be called directly.
global override List<List<String>> getMessageKeys()
Implementation of SubscriptionDescription.Mapping.getMessageKeys(). This method is invoked by the SubscriptionDescriptionController and should not be called directly.
global inherited sharing class LinkingFieldMapping extends Mapping
Mapping that maintains Linking Fields based on information in the Message. See fferpcore.LinkingFieldManager for details on the fields maintained. Often these LinkControl Messages are received in response to an outgoing message and are used to indicate whether or not the message was successfully handled in the other product.
global override Set<String> getAdditionalSelections()
Implementation of SubscriptionDescription.Mapping.getAdditionalSelections(). This method is invoked by the fferpcore.SubscriptionDescription and should not be called directly.
Return Value
Any fields that will be updated and therefore need to be queried.
global override void performImmediateActions(fferpcore.SubscriptionDescription.ApplyMappingRequest request)
Implementation of SubscriptionDescription.Mapping.performImmediateActions(SubscriptionDescription.ApplyMappingRequest request). This method is invoked by the fferpcore.SubscriptionDescription and should not be called directly. Perform any mapping functionality on the given request only.
Implementation of SubscriptionDescription.Mapping.getTargetFields(). This method is invoked by the SubscriptionDescriptionController and should not be called directly.
global override List<List<String>> getMessageKeys()
Implementation of SubscriptionDescription.Mapping.getMessageKeys(). This method is invoked by the SubscriptionDescriptionController and should not be called directly.