MFCORE_DataServiceInterface Interface
Interface that all data services needs to implement. This interface contains the requirements for parameters as well as return value. Either implement this interface directly or override the default implementation found in class MET_DataService.
Namespace
mfwe
Methods
getSourceFormat()
Returns the supported data source format and by that tells you what method to call. If COMPLEX_NODE is returned then getData() method must be invoked. If XML_NODE is returned then getXmlData() method must be invoked. If XML_STRING is returned the getStringData() method must be invoked.
Signature
global MFWED_ApiTypes.SourceFormat getSourceFormat()Return Type
MFWED_ApiTypes.SourceFormat
The format this class supports, being one of: COMPLEX_NODE, XML_NODE or XML_STRING.
getData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)
Returns a complex node hierarchy of data to be used in a Metaforce template.
Signature
global 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 |
| dataTemplateName | String | Name of Salesforce data template |
Return Type
MFWED_ApiTypes.ComplexNode
Node hierarchy of complex nodes. Will be transformed into XML or JSON by calling method
getXmlData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)
Returns an XML DOM to be used in a Metaforce template.
Signature
global 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. IMPORTANT: The Dom.Document must contain a root node named Data without namespace.
Example
// Example to create a Data root node with attribute and child node:
Dom.Document doc = new Dom.Document();
Dom.XmlNode data = doc.createRootElement('Data', null, null);
data.setAttribute(key, value); // Set attributes on Data root node
Dom.XmlNode childNode = data.addChildElement(nodeName, null, null); // Add child nodes to Data root node
return doc;getStringData(SObjectName, recordId, templateName, description, recipientSObjectName, dataTemplateName)
Signature
global 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. IMPORTANT: The XML string must contain a root node named Data without namespace.
Example
// Example to create a Data root node with attribute and child node:
String xmlString = '';
xmlString += '<Data key="value">';
xmlString += ' <User Name="Helge Andersson" UserName="helge.andersson@fisk.se"/>';
xmlString += ' <Account Name="Nisses Fisk AB" Phone="+46811111111"/>';
xmlString += '</Data>';
return xmlString;