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
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
| Name | Type | Description |
|---|---|---|
| SObjectName | String | Name of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’ |
| recordId | String | Id of Salesforce record |
| templateName | String | Name (API name) of Metaforce template |
| description | String | Description of the template |
| recipientSObjectName | String | Name of SObject to use for Lookup |
| dataTemplateName | String | Name 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
| Name | Type | Description |
|---|---|---|
| SObjectName | String | Name of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’ |
| recordId | String | Id of Salesforce record |
| templateName | String | Name (API name) of Metaforce template |
| description | String | Description of the template |
| recipientSObjectName | String | Name of SObject to use for Lookup |
| dataTemplateName | String | Name 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
| Name | Type | Description |
|---|---|---|
| SObjectName | String | Name of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’ |
| recordId | String | Id of Salesforce record |
| templateName | String | Name (API name) of Metaforce template |
| description | String | Description of the template |
| recipientSObjectName | String | Name of SObject to use for Lookup TODO: Maybe change to Lookup field name |
| dataTemplateName | String | Name 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
| Name | Type | Description |
|---|---|---|
| SObjectName | String | Name of SObject, for instance ‘Account’, ‘Case’, or ‘MyCustomObject__c’ |
| recordId | String | Id of Salesforce record |
| recipientSObjectName | String | Name 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