MFCORE_DataService Class

virtual

Default data service that pulls a single record or a single parent record and related child records from Salesforce database. Parent and child relationships are managed per template in custom metadata.

This is a virtual class that can be extended. The getData() method needs to be overridden with your custom implementation of data source. Such source could be pulling data from an external system using REST API for instance. The method createUserNode() can be called to create a standard node containing Salesforce user information.

Namespace

mfwe

Implements

MFCORE_DataServiceInterface

Methods

getSourceFormat()

Get source format for this implementation. Customer’s own implementation must specify which format is returned and hence which method is used to get data.

Signature

global virtual MFWED_ApiTypes.SourceFormat getSourceFormat()

Return Type

MFWED_ApiTypes.SourceFormat

Source format. Being one of the following: COMPLEX_NODE, XML_DOM or XML_STRING


getXmlData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)

Get data in XML format. Virtual method that can be overridden by customer’s own implementation.

Signature

global virtual Dom.Document getXmlData(String SObjectName, String recordId, String templateName, String description, String recipientSObjectName, String dataTemplateName)

Parameters

NameTypeDescription
SObjectNameStringName of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’
recordIdStringId of Salesforce record
templateNameStringName (API name) of Metaforce template
descriptionStringDescription of the template
recipientSObjectNameStringName of SObject to use for Lookup
dataTemplateNameStringName of Salesforce data template

Return Type

Dom.Document

XML DOM document


getStringData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)

Get data as XML string format. Virtual method that can be overridden by customer’s own implementation.

Signature

global virtual String getStringData(String SObjectName, String recordId, String templateName, String description, String recipientSObjectName, String dataTemplateName)

Parameters

NameTypeDescription
SObjectNameStringName of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’
recordIdStringId of Salesforce record
templateNameStringName (API name) of Metaforce template
descriptionStringDescription of the template
recipientSObjectNameStringName of SObject to use for Lookup
dataTemplateNameStringName of Salesforce data template

Return Type

String

XML string


getData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)

Get data in complex node format. Virtual method that can be overridden by customer’s own implementation.

Signature

global virtual MFWED_ApiTypes.ComplexNode getData(String SObjectName, String recordId, String templateName, String description, String recipientSObjectName, String dataTemplateName)

Parameters

NameTypeDescription
SObjectNameStringName of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’
recordIdStringId of Salesforce record
templateNameStringName (API name) of Metaforce template
descriptionStringDescription of the template
recipientSObjectNameStringName of SObject to use for Lookup TODO: Maybe change to Lookup field name
dataTemplateNameStringName of Salesforce data template

Return Type

MFWED_ApiTypes.ComplexNode

Node hierarchy of complex nodes. Can be transformed into XML or JSON


createUserNode()

Create a complex node containing running user information

Signature

global virtual MFWED_ApiTypes.ComplexNode createUserNode()

Return Type

MFWED_ApiTypes.ComplexNode

Complex node containing running user information


createReceiverAddressNode(SObjectName, recordId, recipientSObjectName)

Create a complex node containing receiver address information

Signature

global virtual MFWED_ApiTypes.ComplexNode createReceiverAddressNode(String SObjectName, String recordId, String recipientSObjectName)

Parameters

NameTypeDescription
SObjectNameStringName of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’
recordIdStringId of Salesforce record
recipientSObjectNameStringName of SObject to use for Lookup

Return Type

MFWED_ApiTypes.ComplexNode

Complex node containing receiver address information

Classes

MFCORE_DataServiceException Class

Exception thrown when SSN and VAT are empty. Make sure at least one of SSN and VAT are set!

MFCORE_DataServiceMissingDataException Class

Exception thrown when data service fails to retrieve data from related object following a lookup relationship