MFAPI_WebEditor Class
Namespace
mfwe
Methods
getInstance()
Get singleton instance of this class
Signature
global static MFAPI_WebEditor getInstance()Return Type
The singleton instance of this class
Example
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor.getInstance();getSchemas()
Call this static method to get the list of all defined schemas in Metaforce.
Signature
global static List<MFWED_ApiTypes.ArchiveSchemaResponse> getSchemas()Return Type
List<MFWED_ApiTypes.ArchiveSchemaResponse>
List of all defined schemas in Metaforce.
Example
List<mfwe.MFWED_ApiTypes.ArchiveSchemaResponse> schemas = mfwe.MFAPI_WebEditor.getSchemas();getSchemasDyn()
Call this method to get the list of all defined schemas in Metaforce.
Signature
global List<MFWED_ApiTypes.ArchiveSchemaResponse> getSchemasDyn()Return Type
List<MFWED_ApiTypes.ArchiveSchemaResponse>
List of all defined schemas in Metaforce.
Example
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor.getInstance();
List<mfwe.MFWED_ApiTypes.ArchiveSchemaResponse> schemas = api.getSchemas();getMetaforceTemplates(params)
Call this static method to get the complete list of templates from Metaforce. Use the parameter to specify the logic file in Metaforce to use.
Signature
global static MFWED_ApiTypes.OnlineDocuments getMetaforceTemplates(GetMetaforceTemplatesParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetMetaforceTemplatesParams | Parameters containing Metaforce configuration |
Return Type
MFWED_ApiTypes.OnlineDocuments
A hierarchical list of ALL templates from Metaforce. Use keywords to filter out relevant templates.
Example
mfwe.MFAPI_WebEditor.GetMetaforceTemplatesParams params =
new mfwe.MFAPI_WebEditor.GetMetaforceTemplatesParams();
params.setMetaLogic('Salesforce');
mfwe.MFWED_ApiTypes.OnlineDocuments templates =
mfwe.MFAPI_WebEditor.getMetaforceTemplates(params);
System.debug(templates.Distributions);
System.debug(templates.Root.Documents[0].Name);
System.debug(templates.Root.Documents[0].KeyWords);getMetaforceTemplatesDyn(params)
Call this method to get the complete list of templates from Metaforce. Use the parameter to specify the logic file in Metaforce to use.
Signature
global MFWED_ApiTypes.OnlineDocuments getMetaforceTemplatesDyn(GetMetaforceTemplatesParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetMetaforceTemplatesParams | Parameters containing Metaforce configuration |
Return Type
MFWED_ApiTypes.OnlineDocuments
A hierarchical list of ALL templates from Metaforce. Use keywords to filter out relevant templates.
Example
mfwe.MFAPI_WebEditor.GetMetaforceTemplatesParams params =
new mfwe.MFAPI_WebEditor.GetMetaforceTemplatesParams();
params.setMetaLogic('Salesforce');
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor.getInstance();
mfwe.MFWED_ApiTypes.OnlineDocuments templates =
api.getMetaforceTemplatesDyn(params);
System.debug(templates.Distributions);
System.debug(templates.Root.Documents[0].Name);
System.debug(templates.Root.Documents[0].KeyWords);dynamoSearch(params)
Call this static method to search for a list of documents in dynamo with its corresponding metadata from Metaforce by specifying search criteria.
Signature
global static List<MFWED_ApiTypes.DynamoSearchResponse> dynamoSearch(DynamoSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | DynamoSearchParams | Parameters containing search specification. |
Return Type
List<MFWED_ApiTypes.DynamoSearchResponse>
List of all documents, with its metadata, found when searching Metaforce dynamo.
Example
mfwe.MFAPI_WebEditor.DynamoSearchParams params =
new mfwe.MFAPI_WebEditor.DynamoSearchParams()
.setTop(10)
.setResultColumns(new List<String> {'SFID', 'TEMPLATE', 'DESCRIPTION'})
.addSorters('PRINTDATE', 'DESC')
.addWhereConditions('Faktura', 'EQ', 'TEMPLATE', 'AND');
List<mfwe.MFWED_ApiTypes.DynamoSearchResponse> responses =
mfwe.MFAPI_WebEditor.dynamoSearch(params);dynamoSearchDyn(params)
Call this method to search for a list of documents in dynamo with its corresponding metadata from Metaforce by specifying search criteria.
Signature
global List<MFWED_ApiTypes.DynamoSearchResponse> dynamoSearchDyn(DynamoSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | DynamoSearchParams | Parameters containing search specification. |
Return Type
List<MFWED_ApiTypes.DynamoSearchResponse>
List of all documents, with its metadata, found when searching Metaforce dynamo.
Example
mfwe.MFAPI_WebEditor.DynamoSearchParams params =
new mfwe.MFAPI_WebEditor.DynamoSearchParams()
.setTop(10)
.setResultColumns(new List<String> {'SFID', 'TEMPLATE', 'DESCRIPTION'})
.addSorters('PRINTDATE', 'DESC')
.addWhereConditions('Faktura', 'EQ', 'TEMPLATE', 'AND');
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor.getInstance();
List<mfwe.MFWED_ApiTypes.DynamoSearchResponse> responses =
api.dynamoSearchDyn(params);archiveSearch(params)
Call this static method to search for a list of archived documents with its corresponding metadata from Metaforce by specifying search criteria.
Signature
global static MFWED_ApiTypes.ArchiveSearchResponse archiveSearch(ArchiveSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveSearchParams | Parameters containing search specification. |
Return Type
MFWED_ApiTypes.ArchiveSearchResponse
A list of archived documents with its corresponding metadata from Metaforce.
Example
mfwe.MFAPI_WebEditor.ArchiveSearchParams params =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp =
mfwe.MFAPI_WebEditor.archiveSearch(params);
System.debug(archResp.DocumentModel[0].Metadata.get('PRINTDATE'));archiveSearchDyn(params)
Call this method to search for a list of archived documents with its corresponding metadata from Metaforce by specifying search criteria.
Signature
global MFWED_ApiTypes.ArchiveSearchResponse archiveSearchDyn(ArchiveSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveSearchParams | Parameters containing search specification. |
Return Type
MFWED_ApiTypes.ArchiveSearchResponse
A list of archived documents with its corresponding metadata from Metaforce.
Example
mfwe.MFAPI_WebEditor.ArchiveSearchParams params =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp =
api.archiveSearchDyn(params);
System.debug(archResp.DocumentModel[0].Metadata.get('PRINTDATE'));archiveSearchBatch(params)
Call this static method from a batch job to search for a list of archived documents with its corresponding metadata from Metaforce by specifying search criteria. You may call these methods from a batch job multiple times from a batch to search for a list of archived documents. After calling these method one or more times you have to call the method batchEnd() to finish logging. You can also call this static method from a not batch job, This method enables multiple calls to the Metaforce API. But it must be called with the method batchEnd() to finish logging.
Signature
global static MFWED_ApiTypes.ArchiveSearchResponse archiveSearchBatch(ArchiveSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveSearchParams | Parameters containing search specification. |
Return Type
MFWED_ApiTypes.ArchiveSearchResponse
A list of archived documents with its corresponding metadata from Metaforce.
Example
mfwe.MFAPI_WebEditor.ArchiveSearchParams params1 =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp1 =
mfwe.MFAPI_WebEditor.archiveSearchBatch(params1);
System.debug(archResp1.DocumentModel[0].Metadata.get('PRINTDATE'));
mfwe.MFAPI_WebEditor.ArchiveSearchParams params2 =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp2 =
mfwe.MFAPI_WebEditor.archiveSearchBatch(params2);
System.debug(archResp2.DocumentModel[0].Metadata.get('PRINTDATE'));
mfwe.MFAPI_WebEditor.batchEnd();archiveSearchBatchDyn(params)
Call this method from a batch job to search for a list of archived documents with its corresponding metadata from Metaforce by specifying search criteria. You may call these methods from a batch job multiple times from a batch to search for a list of archived documents. After calling these method one or more times you have to call the method batchEndDyn() to finish logging. You can also call this static method from a not batch job, This method enables multiple calls to the Metaforce API. But it must be called with the method batchEndDyn() to finish logging.
Signature
global MFWED_ApiTypes.ArchiveSearchResponse archiveSearchBatchDyn(ArchiveSearchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveSearchParams | Parameters containing search specification. |
Return Type
MFWED_ApiTypes.ArchiveSearchResponse
A list of archived documents with its corresponding metadata from Metaforce.
Example
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFAPI_WebEditor.ArchiveSearchParams params1 =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp1 =
api.archiveSearchBatchDyn(params1);
System.debug(archResp1.DocumentModel[0].Metadata.get('PRINTDATE'));
mfwe.MFAPI_WebEditor.ArchiveSearchParams params2 =
new mfwe.MFAPI_WebEditor.ArchiveSearchParams()
.addSearchSpec('SSN', '123456789012', 'EQ')
.addSearchSpec('MEDLEMSNUMMER', '999999', 'EQ')
.addSearchSpec('TEMPLATE', 'Faktura', 'NE')
.setChainer('AND')
.setSortByKey('ArchiveDate')
.setSortOrder('DESC')
.setSkip(0)
.setTake(10);
mfwe.MFWED_ApiTypes.ArchiveSearchResponse archResp2 =
api.archiveSearchBatchDyn(params2);
System.debug(archResp2.DocumentModel[0].Metadata.get('PRINTDATE'));
api.batchEndDyn();dynamoUpdateMetadata(params)
Call this static method to update metadata for a document in dynamo given by docId and jobId
Signature
global static String dynamoUpdateMetadata(UpdateMetadataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | UpdateMetadataParams | Parameters containing jobId, docId and new metadata key/value pairs |
Return Type
String
Resulting string (response body) from Metaforce
Throws
MFWED_WebEditorException: if the update fails
Example
mfwe.MFAPI_WebEditor.UpdateMetadataParams params =
new mfwe.MFAPI_WebEditor.UpdateMetadataParams();
params.jobId = 94299;
params.docId = 1;
params.updateColumns = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF'
};
mfwe.MFAPI_WebEditor.dynamoUpdateMetadata(params);dynamoUpdateMetadataDyn(params)
Call this method to update metadata for a document in dynamo given by docId and jobId
Signature
global String dynamoUpdateMetadataDyn(UpdateMetadataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | UpdateMetadataParams | Parameters containing jobId, docId and new metadata key/value pairs |
Return Type
String
Resulting string (response body) from Metaforce
Throws
MFWED_WebEditorException: if the update fails
Example
mfwe.MFAPI_WebEditor.UpdateMetadataParams params =
new mfwe.MFAPI_WebEditor.UpdateMetadataParams();
params.jobId = 94299;
params.docId = 1;
params.updateColumns = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF'
};
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.dynamoUpdateMetadataDyn(params);archiveUpdateMetadata(params)
Call this static method to update metadata for a document in viewpoint archive given by search id and partition key
Signature
global static MFWED_ApiTypes.ArchiveUpdateMetadataResponse archiveUpdateMetadata(ArchiveUpdateMetadataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveUpdateMetadataParams | Parameters containing search id,partition key and new metadata key/value pairs |
Return Type
MFWED_ApiTypes.ArchiveUpdateMetadataResponse
Resulting string from Metaforce
Throws
MFWED_WebEditorException: if the update fails
Example
mfwe.MFAPI_WebEditor.ArchiveUpdateMetadataParams params =
new mfwe.MFAPI_WebEditor.ArchiveUpdateMetadataParams();
params.searchId = '9ca9d4fb-7d35-471c-871d-21e2a6f9519e';
params.partitionKey = '196312294652';
params.updateColumns = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF'
};
mfwe.MFAPI_WebEditor.archiveUpdateMetadata(params);archiveUpdateMetadataDyn(params)
Call this method to update metadata for a document in viewpoint archive given by search id and partition key
Signature
global MFWED_ApiTypes.ArchiveUpdateMetadataResponse archiveUpdateMetadataDyn(ArchiveUpdateMetadataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveUpdateMetadataParams | Parameters containing search id,partition key and new metadata key/value pairs |
Return Type
MFWED_ApiTypes.ArchiveUpdateMetadataResponse
Resulting string from Metaforce
Throws
MFWED_WebEditorException: if the update fails
Example
mfwe.MFAPI_WebEditor.ArchiveUpdateMetadataParams params =
new mfwe.MFAPI_WebEditor.ArchiveUpdateMetadataParams();
params.searchId = '9ca9d4fb-7d35-471c-871d-21e2a6f9519e';
params.partitionKey = '196312294652';
params.updateColumns = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF'
};
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.archiveUpdateMetadataDyn(params);archiveUpload(params)
Call this static method to upload a document and store in Metaforce archive.
Signature
global static MFWED_ApiTypes.ArchiveUploadResponse archiveUpload(ArchiveUploadParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveUploadParams | Parameters containing retention policy, metadata key/value pairs, file and content type. PartitionKey is mandatory key/value pair in metadata param. |
Return Type
MFWED_ApiTypes.ArchiveUploadResponse
Resulting upload result from Metaforce
Example
mfwe.MFAPI_WebEditor.ArchiveUploadParams params =
new mfwe.MFAPI_WebEditor.ArchiveUploadParams();
params.retentionPolicy = 'My Policy';
params.metadata = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF',
'PARTITIONKEY' => 'ab547d97c935f'
};
params.file = EncodingUtil.base64Encode(fileBlob);
params.contentType = 'application/pdf';
mfwe.MFAPI_WebEditor.archiveUpload(params);archiveUploadDyn(params)
Call this method to upload a document and store in Metaforce archive.
Signature
global MFWED_ApiTypes.ArchiveUploadResponse archiveUploadDyn(ArchiveUploadParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | ArchiveUploadParams | Parameters containing retention policy, metadata key/value pairs, file and content type. PartitionKey is mandatory key/value pair in metadata param. |
Return Type
MFWED_ApiTypes.ArchiveUploadResponse
Resulting upload result from Metaforce
Example
mfwe.MFAPI_WebEditor.ArchiveUploadParams params =
new mfwe.MFAPI_WebEditor.ArchiveUploadParams();
params.retentionPolicy = 'My Policy';
params.metadata = new Map<String, String> {
'DESCRIPTION' => 'Uteslutning samtliga MF',
'PARTITIONKEY' => 'ab547d97c935f'
};
params.file = EncodingUtil.base64Encode(fileBlob);
params.contentType = 'application/pdf';
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.archiveUploadDyn(params);getDocument(params)
Call this static method to retrieve a specific document from dynamo or the archive.
Signature
global static String getDocument(GetDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetDocumentParams | Parameters containing specification of document to get. |
Return Type
String
String (base64 encoded document Blob)
Example
// Example using jobId and docId to get a document from dynamo
mfwe.MFAPI_WebEditor.GetDocumentParams params1 =
new mfwe.MFAPI_WebEditor.GetDocumentParams();
params1.jobId = 94299;
params1.docId = 1;
String document = mfwe.MFAPI_WebEditor.getDocument(params1);
// Example using searchId to get a document from dynamo
mfwe.MFAPI_WebEditor.GetDocumentParams params2 =
new mfwe.MFAPI_WebEditor.GetDocumentParams();
params2.searchId = 123123123-456456-234234;
String document = mfwe.MFAPI_WebEditor.getDocument(params2);getDocumentDyn(params)
Call this method to retrieve a specific document from dynamo or the archive.
Signature
global String getDocumentDyn(GetDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetDocumentParams | Parameters containing specification of document to get. |
Return Type
String
String (base64 encoded document Blob)
Example
// Example using jobId and docId to get a document from dynamo
mfwe.MFAPI_WebEditor.GetDocumentParams params1 =
new mfwe.MFAPI_WebEditor.GetDocumentParams();
params1.jobId = 94299;
params1.docId = 1;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
String document = api.getDocumentDyn(params1);
// Example using searchId to get a document from dynamo
mfwe.MFAPI_WebEditor.GetDocumentParams params2 =
new mfwe.MFAPI_WebEditor.GetDocumentParams();
params2.searchId = 123123123-456456-234234;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
String document = api.getDocumentDyn(params2);startPrintOrderBatchJob(params)
Call this static method to start the print order batch job. The batch job will pick up all records of type PrintOrder__c having status = ‘Waiting’, and after successful print it changes the status of the record to ‘Done’. Set query to null to use default query. Set query to custom query and also set batchSize to custom value (default is 4 if no query is given).
Default Query
SELECT
Id,
OwnerId,
ErrorLog__c,
PrintedDateTime__c,
RecordId__c,
SObjectName__c,
Status__c,
DistributionMethod__c,
DataService__c,
SystemModstamp,
Template__c,
Type__c,
XML__c,
PrintParameters__c,
MetafileName__c,
Description__c,
AttributeStoreKey__c
FROM PrintOrder__c
WHERE Type__c = 'Batch' AND Status__c = 'Waiting'Signature
global static void startPrintOrderBatchJob(PrintOrderBatchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | PrintOrderBatchParams | Parameters containing specification of batch job to start. |
Return Type
void
Example
// Use custom query and specified batch size
mfwe.MFAPI_WebEditor.PrintOrderBatchParams params1 =
new mfwe.MFAPI_WebEditor.PrintOrderBatchParams();
params1.query = 'SELECT Id, OwnerId, ErrorLog__c, PrintedDateTime__c, RecordId__c, SObjectName__c, Status__c, DistributionMethod__c, DataService__c, SystemModstamp, Template__c, Type__c, XML__c, PrintParameters__c, MetafileName__c, Description__c, AttributeStoreKey__c FROM PrintOrder__c WHERE Type__c = \'Batch\' AND Status__c = \'Waiting\'';
params1.batchSize = 20;
mfwe.MFAPI_WebEditor.startPrintOrderBatchJob(params1);
// Use default query and batch size
mfwe.MFAPI_WebEditor.PrintOrderBatchParams params2 =
new mfwe.MFAPI_WebEditor.PrintOrderBatchParams();
params2.query = null
mfwe.MFAPI_WebEditor.startPrintOrderBatchJob(params2);startPrintOrderBatchJobDyn(params)
Call this method to start the print order batch job. The batch job will pick up all records of type PrintOrder__c having status = ‘Waiting’, and after successful print it changes the status of the record to ‘Done’. Set query to null to use default query. Set query to custom query and also set batchSize to custom value (default is 4 if no query is given).
Default Query
SELECT
Id,
OwnerId,
ErrorLog__c,
PrintedDateTime__c,
RecordId__c,
SObjectName__c,
Status__c,
DistributionMethod__c,
DataService__c,
SystemModstamp,
Template__c,
Type__c,
XML__c,
PrintParameters__c,
MetafileName__c,
Description__c,
AttributeStoreKey__c
FROM PrintOrder__c
WHERE Type__c = 'Batch' AND Status__c = 'Waiting'Signature
global void startPrintOrderBatchJobDyn(PrintOrderBatchParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | PrintOrderBatchParams | Parameters containing specification of batch job to start. |
Return Type
void
Example
// Use custom query and specified batch size
mfwe.MFAPI_WebEditor.PrintOrderBatchParams params1 =
new mfwe.MFAPI_WebEditor.PrintOrderBatchParams();
params1.query = 'SELECT Id, OwnerId, ErrorLog__c, PrintedDateTime__c, RecordId__c, SObjectName__c, Status__c, DistributionMethod__c, DataService__c, SystemModstamp, Template__c, Type__c, XML__c, PrintParameters__c, MetafileName__c, Description__c, AttributeStoreKey__c FROM PrintOrder__c WHERE Type__c = \'Batch\' AND Status__c = \'Waiting\'';
params1.batchSize = 20;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.startPrintOrderBatchJobDyn(params1);
// Use default query and batch size
mfwe.MFAPI_WebEditor.PrintOrderBatchParams params2 =
new mfwe.MFAPI_WebEditor.PrintOrderBatchParams();
params2.query = null
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.startPrintOrderBatchJobDyn(params2);storeAuthToken()
Call this static method to store last auth token in persistent store. Next apex execution context will then be able to reuse last token until it expires. After expiration a new token automatically will be created. Call this method after the LAST webservice call out.
Signature
global static void storeAuthToken()Return Type
void
Example
mfwe.MFAPI_WebEditor.storeAuthToken();storeAuthTokenDyn()
Call this method to store last auth token in persistent store. Next apex execution context will then be able to reuse last token until it expires. After expiration a new token automatically will be created. Call this method after the LAST webservice call out.
Signature
global void storeAuthTokenDyn()Return Type
void
Example
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
api.storeAuthTokenDyn();saveDocument(params)
Call this static method to immediately create a document based on selected template and record.
Signature
global static MFWED_ApiTypes.DistributeSendResponse saveDocument(SaveDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | SaveDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting string from Metaforce.
Example
Contact con = [SELECT Id FROM Contact WHERE LastName = 'Test' LIMIT 1];
mfwe.MFAPI_WebEditor.SaveDocumentParams params = new mfwe.MFAPI_WebEditor.SaveDocumentParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.fileName = 'WelcomeLetter';
params.sObjectName = 'Contact';
params.recordId = con.Id;
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'ContactWithRelatedAccount';
params.classification = null;
mfwe.MFWED_ApiTypes.DistributeSendResponse result = mfwe.MFAPI_WebEditor.saveDocument(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);saveDocumentDyn(params)
Call this method to immediately create a document based on selected template and record.
Signature
global MFWED_ApiTypes.DistributeSendResponse saveDocumentDyn(SaveDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | SaveDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting string from Metaforce.
Example
Contact con = [SELECT Id FROM Contact WHERE LastName = 'Test' LIMIT 1];
mfwe.MFAPI_WebEditor.SaveDocumentParams params = new mfwe.MFAPI_WebEditor.SaveDocumentParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.fileName = 'WelcomeLetter';
params.sObjectName = 'Contact';
params.recordId = con.Id;
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'ContactWithRelatedAccount';
params.classification = null;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.DistributeSendResponse result = api.saveDocumentDyn(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);saveDocumentBatch(params)
Call this static method from a batch job to immediately create a document based on selected template and record. You may call this method from a batch job multiple times from a batch to create a document based on a template and record. After calling this method one or more times you have to call the method batchEnd() to finish logging.
Signature
global static MFWED_ApiTypes.DistributeSendResponse saveDocumentBatch(SaveDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | SaveDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting string from Metaforce.
Example
mfwe.MFAPI_WebEditor.SaveDocumentParams params = new mfwe.MFAPI_WebEditor.SaveDocumentParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.fileName = 'WelcomeLetter';
params.sObjectName = 'Contact';
params.recordId = '0031I00000Q1v3vQAB';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'ContactWithRelatedAccount';
params.classification = null;
mfwe.MFWED_ApiTypes.DistributeSendResponse result = mfwe.MFAPI_WebEditor.saveDocumentBatch(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);saveDocumentBatchDyn(params)
Call this method from a batch job to immediately create a document based on selected template and record. You may call this method from a batch job multiple times from a batch to create a document based on a template and record. After calling this method one or more times you have to call the method batchEnd() to finish logging.
Signature
global MFWED_ApiTypes.DistributeSendResponse saveDocumentBatchDyn(SaveDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | SaveDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting string from Metaforce.
Example
mfwe.MFAPI_WebEditor.SaveDocumentParams params = new mfwe.MFAPI_WebEditor.SaveDocumentParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.fileName = 'WelcomeLetter';
params.sObjectName = 'Contact';
params.recordId = '0031I00000Q1v3vQAB';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'ContactWithRelatedAccount';
params.classification = null;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.DistributeSendResponse result = api.saveDocumentBatchDyn(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);batchEnd()
Call this method after all calls to saveDocumentBatch() or archiveSearchBatch() are done. This method should be called after calling saveDocumentBatch() or archiveSearchBatch() one or more times.
See method saveDocumentBatch() for an example.
Signature
global static void batchEnd()Return Type
void
batchEndDyn()
Call this method after all calls to saveDocumentBatchDyn() or archiveSearchBatchDyn() are done. This method should be called after calling saveDocumentBatchDyn() or archiveSearchBatchDyn() one or more times.
See method saveDocumentBatchDyn() for an example.
Signature
global void batchEndDyn()Return Type
void
createDocument(params)
Call this static method to immediately create and store a document based on selected template and and complex nodes.
Signature
global static MFWED_ApiTypes.DistributeSendResponse createDocument(CreateDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreateDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting response from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreateDocumentParams params = new mfwe.MFAPI_WebEditor.CreateDocumentParams();
Contact con = [SELECT Id, Name FROM Contact WHERE LastName = 'Test' LIMIT 1];
mfwe.MFWED_ApiTypes.ComplexNode dataNode = new mfwe.MFWED_ApiTypes.ComplexNode(
'Contact',
con.Id,
'Letter',
'My letter'
);
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.nodes = dataNode;
mfwe.MFWED_ApiTypes.DistributeSendResponse result = mfwe.MFAPI_WebEditor.createDocument(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);createDocumentDyn(params)
Call this method to immediately create and store a document based on selected template and and complex nodes.
Signature
global MFWED_ApiTypes.DistributeSendResponse createDocumentDyn(CreateDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreateDocumentParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting response from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreateDocumentParams params = new mfwe.MFAPI_WebEditor.CreateDocumentParams();
Contact con = [SELECT Id, Name FROM Contact WHERE LastName = 'Test' LIMIT 1];
mfwe.MFWED_ApiTypes.ComplexNode dataNode = new mfwe.MFWED_ApiTypes.ComplexNode(
'Contact',
con.Id,
'Letter',
'My letter'
);
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.nodes = dataNode;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.DistributeSendResponse result = api.createDocumentDyn(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);createDocumentFromXml(params)
Call this static method to immediately create and store a document based on selected template and and XML.
Signature
global static MFWED_ApiTypes.DistributeSendResponse createDocumentFromXml(CreateDocumentXmlParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreateDocumentXmlParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting response from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreateDocumentXmlParams params = new mfwe.MFAPI_WebEditor.CreateDocumentXmlParams();
String xmlData =
'<Data SOBJNAME="Case" SFID="500KK000000wgumYAA" PRINTEDBYID="0050O000007C7drQAC" TEMPLATE="INF_AUTOGIRO" DESCRIPTION="Infobrev Autogiro">' +
' <User UserEmail="olle.olsson@example.com" UserTitle="Developer" UserName="Olle Olsson"/>' +
' <ReceiverAddress ReceiverName="Olle Olsson" SSN="123456789012" EmailTo="olle.olsson@example.com"' +
' CareOfAddress="" VAT="" Street="Gatan 5" PostageNumber="111 11" City="Staden" Country="Sverige"/>' +
' <Case CaseId="500KK000000wgumYAA" CaseCaseNumber="00477983" CaseContactId="0030O00002ibDXqQAM"/>' +
'</Data>';
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.xml = xmlData;
mfwe.MFWED_ApiTypes.DistributeSendResponse result = mfwe.MFAPI_WebEditor.createDocumentFromXml(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);createDocumentFromXmlDyn(params)
Call this method to immediately create and store a document based on selected template and and XML.
Signature
global MFWED_ApiTypes.DistributeSendResponse createDocumentFromXmlDyn(CreateDocumentXmlParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreateDocumentXmlParams | Parameters containing specifications for the document to create. |
Return Type
MFWED_ApiTypes.DistributeSendResponse
Resulting response from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreateDocumentXmlParams params = new mfwe.MFAPI_WebEditor.CreateDocumentXmlParams();
String xmlData =
'<Data SOBJNAME="Case" SFID="500KK000000wgumYAA" PRINTEDBYID="0050O000007C7drQAC" TEMPLATE="INF_AUTOGIRO" DESCRIPTION="Infobrev Autogiro">' +
' <User UserEmail="olle.olsson@example.com" UserTitle="Developer" UserName="Olle Olsson"/>' +
' <ReceiverAddress ReceiverName="Olle Olsson" SSN="123456789012" EmailTo="olle.olsson@example.com"' +
' CareOfAddress="" VAT="" Street="Gatan 5" PostageNumber="111 11" City="Staden" Country="Sverige"/>' +
' <Case CaseId="500KK000000wgumYAA" CaseCaseNumber="00477983" CaseContactId="0030O00002ibDXqQAM"/>' +
'</Data>';
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.distributionMethod = 'Archiving';
params.attributeStoreKey = null;
params.xml = xmlData;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.DistributeSendResponse result = api.createDocumentFromXmlDyn(params);
System.debug('JobId: ' + result.jobId + ', DocId: ' + result.docId + ', Error: ' + result.error);createPdf(params)
Call this static method to immediately render a pdf document based on selected template and and complex nodes. No document is created in Dynamo or Viewpoint.
Signature
global static String createPdf(CreatePdfParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreatePdfParams | Parameters containing specifications for the document to create. See class CreatePdfParams. |
Return Type
String
Resulting PDF as string from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreatePdfParams params = new mfwe.MFAPI_WebEditor.CreatePdfParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.attributeStoreKey = null;
mfwe.MFWED_ApiTypes.ComplexNode dataNode = new mfwe.MFWED_ApiTypes.ComplexNode(
'Contact',
'0031I00000Q1v3vQAB',
'Letter',
'My letter');
params.nodes = dataNode;
String pdf = mfwe.MFAPI_WebEditor.createPdf(params);createPdfDyn(params)
Call this method to immediately render a pdf document based on selected template and and complex nodes. No document is created in Dynamo or Viewpoint.
Signature
global String createPdfDyn(CreatePdfParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | CreatePdfParams | Parameters containing specifications for the document to create. See class CreatePdfParams. |
Return Type
String
Resulting PDF as string from Metaforce.
Example
mfwe.MFAPI_WebEditor.CreatePdfParams params = new mfwe.MFAPI_WebEditor.CreatePdfParams();
params.metaFile = 'Salesforce';
params.documentName = 'WelcomeLetter';
params.attributeStoreKey = null;
mfwe.MFWED_ApiTypes.ComplexNode dataNode = new mfwe.MFWED_ApiTypes.ComplexNode(
'Contact',
'0031I00000Q1v3vQAB',
'Letter',
'My letter');
params.nodes = dataNode;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
String pdf = api.createPdfDyn(params);getTemplate(params)
Call this static method to get template information based on params.
Signature
global static MFWED_ApiTypes.Template getTemplate(GetTemplateParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetTemplateParams | Parameters containing specifications for the template to get. |
Return Type
MFWED_ApiTypes.Template
Template information if found, null if not found.
Example
mfwe.MFAPI_WebEditor.GetTemplateParams params = new mfwe.MFAPI_WebEditor.GetTemplateParams();
params.templateName = 'MyTemplateName';
mfwe.MFWED_ApiTypes.Template template = mfwe.MFAPI_WebEditor.getTemplate(params);
System.debug('Description: ' + template.Description + ', HasProcess: ' + template.HasProcess);getTemplateDyn(params)
Call this method to get template information based on params.
Signature
global MFWED_ApiTypes.Template getTemplateDyn(GetTemplateParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetTemplateParams | Parameters containing specifications for the template to get. |
Return Type
MFWED_ApiTypes.Template
Template information if found, null if not found.
Example
mfwe.MFAPI_WebEditor.GetTemplateParams params = new mfwe.MFAPI_WebEditor.GetTemplateParams();
params.templateName = 'MyTemplateName';
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.Template template = api.getTemplateDyn(params);
System.debug('Description: ' + template.Description + ', HasProcess: ' + template.HasProcess);getSobjectRecordAsKeyValueData(params)
Call this static method to read a record from the database with all fields and return it as a key value pair list.
Signature
global static List<MFWED_ApiTypes.KeyValueData> getSobjectRecordAsKeyValueData(GetSobjectRecordAsKeyValueDataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetSobjectRecordAsKeyValueDataParams | parameters containing sObjectName & recordId |
Return Type
List<MFWED_ApiTypes.KeyValueData>
List of key value pairs
Example
mfwe.MFAPI_WebEditor.GetSobjectRecordAsKeyValueDataParams params =
new mfwe.MFAPI_WebEditor.GetSobjectRecordAsKeyValueDataParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.sObjectName = 'Account';
params.recordId = acc.Id;
List<mfwe.MFWED_ApiTypes.KeyValueData> keyValueData =
mfwe.MFAPI_WebEditor.getSobjectRecordAsKeyValueData(params);
for (mfwe.MFWED_ApiTypes.KeyValueData kv : keyValueData) {
System.debug('Key: ' + kv.Key + ', Value: ' + kv.Value);
}getSobjectRecordAsKeyValueDataDyn(params)
Call this method to read a record from the database with all fields and return it as a key value pair list.
Signature
global List<MFWED_ApiTypes.KeyValueData> getSobjectRecordAsKeyValueDataDyn(GetSobjectRecordAsKeyValueDataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetSobjectRecordAsKeyValueDataParams | parameters containing sObjectName & recordId |
Return Type
List<MFWED_ApiTypes.KeyValueData>
List of key value pairs
Example
mfwe.MFAPI_WebEditor.GetSobjectRecordAsKeyValueDataParams params =
new mfwe.MFAPI_WebEditor.GetSobjectRecordAsKeyValueDataParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.sObjectName = 'Account';
params.recordId = acc.Id;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
List<mfwe.MFWED_ApiTypes.KeyValueData> keyValueData =
api.getSobjectRecordAsKeyValueDataDyn(params);
for (mfwe.MFWED_ApiTypes.KeyValueData kv : keyValueData) {
System.debug('Key: ' + kv.Key + ', Value: ' + kv.Value);
}getSobjectChildRecordsAsKeyValueData(params)
Call this static method to read child records from the database with all fields and return it as a map of record ids with key value pair list. Provide a filter (SQL where clause) to filter child records. Use null if no filter.
Signature
global static Map<Id,List<MFWED_ApiTypes.KeyValueData>> getSobjectChildRecordsAsKeyValueData(GetSobjectChildRecordsAsKeyValueDataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetSobjectChildRecordsAsKeyValueDataParams | parameters containing sObjectName, parentFiledName, recordId and filter |
Return Type
Map<Id,List<MFWED_ApiTypes.KeyValueData>>
Map of record ids with List of key value pairs representing child records’ fields and values
Example
mfwe.MFAPI_WebEditor.GetSobjectChildRecordsAsKeyValueDataParams params =
new mfwe.MFAPI_WebEditor.GetSobjectChildRecordsAsKeyValueDataParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.sObjectName = 'Contact';
params.parentFieldName = 'AccountId';
params.recordId = acc.Id;
params.filter = 'IsActive__c = TRUE';
Map<Id, List<mfwe.MFWED_ApiTypes.KeyValueData>> keyValueData =
mfwe.MFAPI_WebEditor.getSobjectChildRecordsAsKeyValueData(params);
for (Id childRecordId : keyValueData.keySet()) {
System.debug('Child RecordId: ' + childRecordId);
for (mfwe.MFWED_ApiTypes.KeyValueData field : keyValueData.get(childRecordId)) {
System.debug('Field: ' + field.Key + ', Value: ' + field.Value);
}
System.debug('---');
}getSobjectChildRecordsAsKeyValueDataDyn(params)
Call this method to read child records from the database with all fields and return it as a map of record ids with key value pair list. Provide a filter (SQL where clause) to filter child records. Use null if no filter.
Signature
global Map<Id,List<MFWED_ApiTypes.KeyValueData>> getSobjectChildRecordsAsKeyValueDataDyn(GetSobjectChildRecordsAsKeyValueDataParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetSobjectChildRecordsAsKeyValueDataParams | parameters containing sObjectName, parentFiledName, recordId and filter |
Return Type
Map<Id,List<MFWED_ApiTypes.KeyValueData>>
Map of record ids with List of key value pairs representing child records’ fields and values
Example
mfwe.MFAPI_WebEditor.GetSobjectChildRecordsAsKeyValueDataParams params =
new mfwe.MFAPI_WebEditor.GetSobjectChildRecordsAsKeyValueDataParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.sObjectName = 'Contact';
params.parentFieldName = 'AccountId';
params.recordId = acc.Id;
params.filter = 'IsActive__c = TRUE';
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
Map<Id, List<mfwe.MFWED_ApiTypes.KeyValueData>> keyValueData =
api.getSobjectChildRecordsAsKeyValueData(params);
for (Id childRecordId : keyValueData.keySet()) {
System.debug('Child RecordId: ' + childRecordId);
for (mfwe.MFWED_ApiTypes.KeyValueData field : keyValueData.get(childRecordId)) {
System.debug('Field: ' + field.Key + ', Value: ' + field.Value);
}
System.debug('---');
}webEditDocument(params)
Call this static method to initiate a web editor session.
Signature
global static MFWED_ApiTypes.WebEditDocumentResponse webEditDocument(WebEditDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | WebEditDocumentParams | parameters containing all necessary data for creating a web editor session |
Return Type
MFWED_ApiTypes.WebEditDocumentResponse
Webeditor response with unique dxml Id, valid to datetime and start url for webeditor session
Example
mfwe.MFAPI_WebEditor.WebEditDocumentParams params =
new mfwe.MFAPI_WebEditor.WebEditDocumentParams();
String xmlData =
'<Data SOBJNAME="Case" SFID="500KK000000wgumYAA" PRINTEDBYID="0050O000007C7drQAC" TEMPLATE="INF_AUTOGIRO" DESCRIPTION="Infobrev Autogiro">' +
' <User UserEmail="olle.olsson@example.com" UserTitle="Developer" UserName="Olle Olsson"/>' +
' <ReceiverAddress ReceiverName="Olle Olsson" SSN="123456789012" EmailTo="olle.olsson@example.com"' +
' CareOfAddress="" VAT="" Street="Gatan 5" PostageNumber="111 11" City="Staden" Country="Sverige"/>' +
' <Case CaseId="500KK000000wgumYAA" CaseCaseNumber="00477983" CaseContactId="0030O00002ibDXqQAM"/>' +
'</Data>';
params.metaFile = 'Salesforce';
params.documentName = 'MyTemplateName';
params.fileName = 'MyFileName';
params.sObjectName = 'Account';
params.recordId = '0010Y00000A1b2cQAB';
params.attributeStore = 'MyAttributeStoreKey';
params.classification = 'MyClassification';
params.xmlString = xmlData;
mfwe.MFWED_ApiTypes.WebEditDocumentResponse response =
mfwe.MFAPI_WebEditor.webEditDocument(params);
System.debug(response.DxmlUID);
System.debug(response.StartURL);
System.debug(response.ValidTo);
System.debug(response.error);webEditDocumentDyn(params)
Call this method to initiate a web editor session.
Signature
global MFWED_ApiTypes.WebEditDocumentResponse webEditDocumentDyn(WebEditDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | WebEditDocumentParams | parameters containing all necessary data for creating a web editor session |
Return Type
MFWED_ApiTypes.WebEditDocumentResponse
Webeditor response with unique dxml Id, valid to datetime and start url for webeditor session
Example
mfwe.MFAPI_WebEditor.WebEditDocumentParams params =
new mfwe.MFAPI_WebEditor.WebEditDocumentParams();
String xmlData =
'<Data SOBJNAME="Case" SFID="500KK000000wgumYAA" PRINTEDBYID="0050O000007C7drQAC" TEMPLATE="INF_AUTOGIRO" DESCRIPTION="Infobrev Autogiro">' +
' <User UserEmail="olle.olsson@example.com" UserTitle="Developer" UserName="Olle Olsson"/>' +
' <ReceiverAddress ReceiverName="Olle Olsson" SSN="123456789012" EmailTo="olle.olsson@example.com"' +
' CareOfAddress="" VAT="" Street="Gatan 5" PostageNumber="111 11" City="Staden" Country="Sverige"/>' +
' <Case CaseId="500KK000000wgumYAA" CaseCaseNumber="00477983" CaseContactId="0030O00002ibDXqQAM"/>' +
'</Data>';
params.metaFile = 'Salesforce';
params.documentName = 'MyTemplateName';
params.fileName = 'MyFileName';
params.sObjectName = 'Account';
params.recordId = '0010Y00000A1b2cQAB';
params.attributeStore = 'MyAttributeStoreKey';
params.classification = 'MyClassification';
params.xmlString = xmlData;
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.WebEditDocumentResponse response =
api.webEditDocument(params);
System.debug(response.DxmlUID);
System.debug(response.StartURL);
System.debug(response.ValidTo);
System.debug(response.error);webEditDocumentStandard(params)
Call this static method to initiate a standard web editor session.
Signature
global static MFWED_ApiTypes.WebEditDocumentResponse webEditDocumentStandard(WebEditDocumentStandardParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | WebEditDocumentStandardParams | parameter containing all necessary data for creating a standard web editor session |
Return Type
MFWED_ApiTypes.WebEditDocumentResponse
Webeditor response with unique dxml Id, valid to datetime and start url for webeditor session
Example
mfwe.MFAPI_WebEditor.WebEditDocumentStandardParams params =
new mfwe.MFAPI_WebEditor.WebEditDocumentStandardParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.metaFile = 'Salesforce';
params.documentName = 'MyTemplateName';
params.fileName = 'MyFileName';
params.sObjectName = 'Account';
params.recordId = acc.Id;
params.attributeStore = 'MyAttribute';
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'MyDataTemplateName';
params.classification = 'MyClassification';
mfwe.MFWED_ApiTypes.WebEditDocumentResponse response =
mfwe.MFAPI_WebEditor.webEditDocumentStandard(params);
System.debug(response.DxmlUID);
System.debug(response.StartURL);
System.debug(response.ValidTo);
System.debug(response.error);webEditDocumentStandardDyn(params)
Call this method to initiate a standard web editor session.
Signature
global MFWED_ApiTypes.WebEditDocumentResponse webEditDocumentStandardDyn(WebEditDocumentStandardParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | WebEditDocumentStandardParams | parameter containing all necessary data for creating a standard web editor session |
Return Type
MFWED_ApiTypes.WebEditDocumentResponse
Webeditor response with unique dxml Id, valid to datetime and start url for webeditor session
Example
mfwe.MFAPI_WebEditor.WebEditDocumentStandardParams params =
new mfwe.MFAPI_WebEditor.WebEditDocumentStandardParams();
Account acc = [SELECT Id FROM Account WHERE Name = 'Test' LIMIT 1];
params.metaFile = 'Salesforce';
params.documentName = 'MyTemplateName';
params.fileName = 'MyFileName';
params.sObjectName = 'Account';
params.recordId = acc.Id;
params.attributeStore = 'MyAttribute';
params.dataService = 'DEFAULT';
params.follow = 'Contact';
params.dataTemplateName = 'MyDataTemplateName';
params.classification = 'MyClassification';
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.WebEditDocumentResponse response =
api.webEditDocumentStandard(params);
System.debug(response.DxmlUID);
System.debug(response.StartURL);
System.debug(response.ValidTo);
System.debug(response.error);getAttributeStore()
Call this static method get attribute store keys from Metaforce.
Signature
global static MFWED_ApiTypes.AttributeStore getAttributeStore()Return Type
MFWED_ApiTypes.AttributeStore
List of attribute store key types and their ids
Example
mfwe.MFWED_ApiTypes.AttributeStore attributeStoreKeys = mfwe.MFAPI_WebEditor.getAttributeStore();
for (mfwe.MFWED_ApiTypes.AttributeDocument doc : attributeStoreKeys.documents) {
System.debug('Id: ' + doc.id + ', Type: ' + doc.type);
}getAttributeStoreDyn()
Call this method get attribute store keys from Metaforce.
Signature
global MFWED_ApiTypes.AttributeStore getAttributeStoreDyn()Return Type
MFWED_ApiTypes.AttributeStore
List of attribute store key types and their ids
Example
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.AttributeStore attributeStoreKeys =api.getAttributeStore();
for (mfwe.MFWED_ApiTypes.AttributeDocument doc : attributeStoreKeys.documents) {
System.debug('Id: ' + doc.id + ', Type: ' + doc.type);
}getAttributeDocument(params)
Call this static method to get the document details for a specific attribute store key in Metaforce.
Signature
global static MFWED_ApiTypes.AttributeDocumentDetail getAttributeDocument(GetAttributeDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetAttributeDocumentParams | Parameters containing attribute store key id |
Return Type
MFWED_ApiTypes.AttributeDocumentDetail
Document details for the attribute store key
Example
mfwe.MFAPI_WebEditor.GetAttributeDocumentParams params = new mfwe.MFAPI_WebEditor.GetAttributeDocumentParams();
params.attributeStoreKeyId = 'MyAttribute';
mfwe.MFWED_ApiTypes.AttributeDocumentDetail detail = mfwe.MFAPI_WebEditor.getAttributeDocument(params);
for (mfwe.MFWED_ApiTypes.Attribute attribute : detail.attributes) {
System.debug('Name: ' + attribute.name + ', Value: ' + attribute.value);
}getAttributeDocumentDyn(params)
Call this static method to get the document details for a specific attribute store key in Metaforce.
Signature
global MFWED_ApiTypes.AttributeDocumentDetail getAttributeDocumentDyn(GetAttributeDocumentParams params)Parameters
| Name | Type | Description |
|---|---|---|
| params | GetAttributeDocumentParams | Parameters containing attribute store key id |
Return Type
MFWED_ApiTypes.AttributeDocumentDetail
Document details for the attribute store key
Example
mfwe.MFAPI_WebEditor.GetAttributeDocumentParams params = new mfwe.MFAPI_WebEditor.GetAttributeDocumentParams();
params.attributeStoreKeyId = 'MyAttribute';
mfwe.MFAPI_WebEditor api = mfwe.MFAPI_WebEditor().getInstance();
mfwe.MFWED_ApiTypes.AttributeDocumentDetail detail = api.getAttributeDocumentDyn(params);
for (mfwe.MFWED_ApiTypes.Attribute attribute : detail.attributes) {
System.debug('Name: ' + attribute.name + ', Value: ' + attribute.value);
}Classes
GetMetaforceTemplatesParams Class
Wrapper class to embed all necessary data for getting a complete list of all templates. It is used as parameter to the methods getMetaforceTemplates() and getMetaforceTemplatesDyn().
Fields
metaLogic
String containing name of meta logic file in Metaforce.
Signature
global metaLogicType
String
Constructors
GetMetaforceTemplatesParams()
Signature
global GetMetaforceTemplatesParams()GetMetaforceTemplatesParams(metaLogic)
Signature
global GetMetaforceTemplatesParams(String metaLogic)Parameters
| Name | Type | Description |
|---|---|---|
| metaLogic | String | String containing name of meta logic file in Metaforce. |
Methods
setMetaLogic(metaLogic)
Set the meta logic file in Metaforce.
Signature
global GetMetaforceTemplatesParams setMetaLogic(String metaLogic)Parameters
| Name | Type | Description |
|---|---|---|
| metaLogic | String | String containing name of meta logic file in Metaforce. |
Return Type
GetMetaforceTemplatesParams
The instance of this class.
DynamoSearchParams Class
Wrapper class to embed all necessary data for searching the Metaforce archive. It is used as parameter to the methods dynamoSearch() and dynamoSearchDyn().
Fields
top
Integer containing the maximum number of records to return.
Signature
global topType
Integer
resultColumns
List of strings containing the names of the columns to return.
Signature
global resultColumnsType
List<String>
sorters
List of sorters to use when sorting the result.
Signature
global sortersType
List<MFWED_ApiTypes.SorterCls>
whereConditions
List of where conditions to use when filtering the result.
Signature
global whereConditionsType
List<MFWED_ApiTypes.WhereConditionsCls>
Constructors
DynamoSearchParams()
Constructor for the class. Setting default values.
Signature
global DynamoSearchParams()Methods
addSorters(column, sortOrder)
Add a sorter to the list of sorters.
Signature
global DynamoSearchParams addSorters(String column, String sortOrder)Parameters
| Name | Type | Description |
|---|---|---|
| column | String | String containing the name of the column to sort by. |
| sortOrder | String | String containing the sort order (‘ASC’ or ‘DESC’). |
Return Type
DynamoSearchParams
The instance of this class. Enables chaining of methods.
setTop(top)
Set the maximum number of records to return.
Signature
global DynamoSearchParams setTop(Integer top)Parameters
| Name | Type | Description |
|---|---|---|
| top | Integer | Integer containing the maximum number of records to return. |
Return Type
DynamoSearchParams
The instance of this class. Enables chaining of methods.
addResultColumns(resultColumnField)
Add a column to the list of result columns.
Signature
global DynamoSearchParams addResultColumns(String resultColumnField)Parameters
| Name | Type | Description |
|---|---|---|
| resultColumnField | String | String containing the name of the column to add. |
Return Type
DynamoSearchParams
The instance of this class. Enables chaining of methods.
setResultColumns(resultColumns)
Set the list of result columns.
Signature
global DynamoSearchParams setResultColumns(List<String> resultColumns)Parameters
| Name | Type | Description |
|---|---|---|
| resultColumns | List<String> | List of strings containing the names of the columns to return. |
Return Type
DynamoSearchParams
The instance of this class. Enables chaining of methods.
addWhereConditions(value, comparer, column, chainer)
Add a where condition to the list of where conditions.
Signature
global DynamoSearchParams addWhereConditions(String value, String comparer, String column, String chainer)Parameters
| Name | Type | Description |
|---|---|---|
| value | String | String containing the value to compare with. |
| comparer | String | String containing the comparer to use (‘EQ’, ‘NE’, ‘GT’, ‘LT’, ‘GE’, ‘LE’). |
| column | String | String containing the name of the column to compare with. |
| chainer | String | String containing the chainer to use (‘AND’ or ‘OR’). |
Return Type
DynamoSearchParams
The instance of this class. Enables chaining of methods.
ArchiveSearchParams Class
Wrapper class to embed all necessary data for searching the Metaforce archive.
It is used as parameter to the methods archiveSearch(), archiveSearchDyn(), archiveSearchBatch() and archiveSearchBatchDyn().
Fields
searchSpec
List of search specifications.
Signature
global searchSpecType
List<MFWED_ApiTypes.SearchSpec>
chainer
Comparator between search conditions ‘AND’ or ‘OR’.
Signature
global chainerType
String
sortOrder
Sort Order (‘ASC’ or ‘DESC’).
Signature
global sortOrderType
String
sortByKey
Name for Metaforce metadata field to use for sorting like: ‘ArchiveDate’.
Signature
global sortByKeyType
String
skip
Number of records to skip e.g. offset, 0 = No offset.
Signature
global skipType
Integer
take
Number of records to return.
Signature
global takeType
Integer
Constructors
ArchiveSearchParams()
Constructor for the class. Setting default values.
Signature
global ArchiveSearchParams()Methods
addSearchSpec(spec)
Add a search specification to the list of search specifications.
Signature
global ArchiveSearchParams addSearchSpec(MFWED_ApiTypes.SearchSpec spec)Parameters
| Name | Type | Description |
|---|---|---|
| spec | MFWED_ApiTypes.SearchSpec | Search specification to add. |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
addSearchSpec(key, value, comparer)
Add a search specification to the list of search specifications.
Signature
global ArchiveSearchParams addSearchSpec(String key, String value, String comparer)Parameters
| Name | Type | Description |
|---|---|---|
| key | String | A key to search for. |
| value | String | A value to search for. |
| comparer | String | A comparer to use ‘AND’ or ‘OR’. |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
setChainer(chainer)
Set the chainer to use.
Signature
global ArchiveSearchParams setChainer(String chainer)Parameters
| Name | Type | Description |
|---|---|---|
| chainer | String | String containing the chainer to use (‘AND’ or ‘OR’). |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
setSortOrder(sortOrder)
Set the sort order to use.
Signature
global ArchiveSearchParams setSortOrder(String sortOrder)Parameters
| Name | Type | Description |
|---|---|---|
| sortOrder | String | String containing the sort order (‘ASC’ or ‘DESC’). |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
setSortByKey(sortByKey)
Set the key to sort by.
Signature
global ArchiveSearchParams setSortByKey(String sortByKey)Parameters
| Name | Type | Description |
|---|---|---|
| sortByKey | String | String containing the name of the column to sort by. |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
setSkip(skip)
Set the number of records to skip.
Signature
global ArchiveSearchParams setSkip(Integer skip)Parameters
| Name | Type | Description |
|---|---|---|
| skip | Integer | Integer containing the number of records to skip. |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
setTake(take)
Set the number of records to return.
Signature
global ArchiveSearchParams setTake(Integer take)Parameters
| Name | Type | Description |
|---|---|---|
| take | Integer | Integer containing the number of records to return. |
Return Type
ArchiveSearchParams
The instance of this class. Enables chaining of methods.
UpdateMetadataParams Class
Wrapper class to embed all necessary data for updating doc in Dynamo
It is used as parameter to the methods dynamoUpdateMetadata() and dynamoUpdateMetadataDyn().
Fields
jobId
Integer containing the job identification.
Signature
global jobIdType
Integer
docId
Integer containing the document identification.
Signature
global docIdType
Integer
updateColumns
Map containing the new metadata key/value pairs.
Signature
global updateColumnsType
Map<String,String>
ArchiveUpdateMetadataParams Class
Wrapper class to embed all necessary data for updating doc in Viewpoint
It is used as parameter to the methods archiveUpdateMetadata() and archiveUpdateMetadataDyn().
Fields
searchId
String containing the search id.
Signature
global searchIdType
String
partitionKey
String containing the partition key.
Signature
global partitionKeyType
String
updateColumns
Map containing the new metadata key/value pairs.
Signature
global updateColumnsType
Map<String,String>
ArchiveUploadParams Class
Wrapper class to embed all necessary data for uploading metadata and file to Viewpoint. PartitionKey is mandatory key/value pair in metadata param.
It is used when calling the methods archiveUpload() and archiveUploadDyn().
Fields
retentionPolicy
String containing the retention policy.
Signature
global retentionPolicyType
String
metadata
Map containing the metadata key/value pairs. ‘PARTITIONKEY’ is mandatory key/value pair!
Signature
global metadataType
Map<String,String>
file
String containing the base64 encoded file contents.
Signature
global fileType
String
contentType
String containing the content type of the file. Typically ‘application/pdf’.
Signature
global contentTypeType
String
GetDocumentParams Class
This class contains parameters for retrieving a specific document from either dynamo or from the archive. Set jobId & docId to get a document from dynamo, or set searchId to get a document from the archive.
It is used when calling the methods getDocument() and getDocumentDyn().
Fields
jobId
Integer containing the job identification.
Signature
global jobIdType
String
docId
Integer containing the document identification.
Signature
global docIdType
String
searchId
String containing the search identification.
Signature
global searchIdType
String
PrintOrderBatchParams Class
Wrapper class to embed all necessary data for running print order batch job. Set query to null to use default query, else set custom query. Set batchSize to custom value if query is set to custom query.
It is used as parameter to the methods startPrintOrderBatchJob() and startPrintOrderBatchJobDyn().
Fields
query
Set to null to use default query, else set custom query.
Signature
global queryType
String
batchSize
Set to custom value if query is set to custom query. Default value is 4
Signature
global batchSizeType
Integer
SaveDocumentParams Class
Wrapper class to embed all necessary data for printing a specific document.
It is used as parameter to the methods saveDocument(), saveDocumentDyn(), saveDocumentBatch() and saveDocumentBatchDyn().
Fields
metaFile
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
fileName
Description of template
Signature
global fileNameType
String
sObjectName
SObjectname, typically ‘Contact’
Signature
global sObjectNameType
String
recordId
Salesforce record id
Signature
global recordIdType
String
distributionMethod
Method of distribution, typically ‘Archiving’ or ‘LocalPrint’
Signature
global distributionMethodType
String
attributeStoreKey
Attribute store key if needed
Signature
global attributeStoreKeyType
String
dataService
Name of data service, typically ‘DEFAULT’
Signature
global dataServiceType
String
follow
What SObjecttype to send to (recipient), typically ‘Contact’ or ‘Account’
Signature
global followType
String
dataTemplateName
Name of data template if applicable
Signature
global dataTemplateNameType
String
classification
Classification of template/document. Used to control access
Signature
global classificationType
String
CreateDocumentParams Class
Wrapper class to embed all necessary data for printing a specific document It is used as parameter to the methods createDocument() and createDocumentDyn().
Fields
metaFile
Usually ‘Salesforce’
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
distributionMethod
Method of distribution, typically ‘Archiving’ or ‘LocalPrint’
Signature
global distributionMethodType
String
attributeStoreKey
Attribute store key if needed
Signature
global attributeStoreKeyType
String
nodes
Nodes to use for creating document
Signature
global nodesType
MFWED_ApiTypes.ComplexNode
CreateDocumentXmlParams Class
Wrapper class to embed all necessary data for printing a specific document. It is used as parameter to the methods createDocumentFromXml() and createDocumentFromXmlDyn().
Fields
metaFile
Usually ‘Salesforce’
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
distributionMethod
Method of distribution, typically ‘Archiving’ or ‘LocalPrint’
Signature
global distributionMethodType
String
attributeStoreKey
Attribute store key if needed
Signature
global attributeStoreKeyType
String
xml
XML string to use for creating document with DATA-tag
Signature
global xmlType
String
CreatePdfParams Class
Wrapper class to embed all necessary data for printing a specific document. It is used as parameter to the methods createPdf() and createPdfDyn().
Fields
metaFile
Usually ‘Salesforce’
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
attributeStoreKey
Attribute store key if needed
Signature
global attributeStoreKeyType
String
nodes
Nodes to use for creating document
Signature
global nodesType
MFWED_ApiTypes.ComplexNode
GetTemplateParams Class
Wrapper class to embed all necessary data for getting a template
It is used as parameter to the methods getTemplate() and getTemplateDyn().
Fields
templateName
Name of template
Signature
global templateNameType
String
GetSobjectRecordAsKeyValueDataParams Class
Wrapper class to embed all necessary data for reading the record. It is used as parameter to the methods getSobjectRecordAsKeyValueData() and getSobjectRecordAsKeyValueDataDyn().
Fields
sObjectName
SObjectname, typically ‘Contact’
Signature
global sObjectNameType
String
recordId
Salesforce record id
Signature
global recordIdType
Id
GetSobjectChildRecordsAsKeyValueDataParams Class
Wrapper class to embed all necessary data for reading child records with optional filter
Fields
sObjectName
SObjectname, typically ‘Contact’
Signature
global sObjectNameType
String
parentFieldName
Parent field name, typically ‘AccountId’
Signature
global parentFieldNameType
String
recordId
Salesforce record id
Signature
global recordIdType
Id
filter
SQL where clause to filter child records. Typically ‘IsActive__c = TRUE’
Signature
global filterType
String
WebEditDocumentParams Class
Wrapper class to embed all necessary data for creating a webeditor session. It is used as parameter to the methods webEditDocument() and webEditDocumentDyn().
Fields
metaFile
Usually ‘Salesforce’
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
fileName
Description of template
Signature
global fileNameType
String
sObjectName
SObjectname, typically ‘Contact’
Signature
global sObjectNameType
String
recordId
Salesforce record id
Signature
global recordIdType
String
attributeStore
Attribute store key if needed
Signature
global attributeStoreType
String
classification
Classification of template/document. Used to control access
Signature
global classificationType
String
xmlString
XML string to use for creating document with DATA-tag
Signature
global xmlStringType
String
WebEditDocumentStandardParams Class
Wrapper class to embed all necessary data for creating a ‘standard=NoXML’ webeditor session. It is used as parameter to the methods webEditDocumentStandard() and webEditDocumentStandardDyn().
Fields
metaFile
Usually ‘Salesforce’
Signature
global metaFileType
String
documentName
Name of template
Signature
global documentNameType
String
fileName
Description of template
Signature
global fileNameType
String
sObjectName
SObjectname, typically ‘Contact’
Signature
global sObjectNameType
String
recordId
Salesforce record id
Signature
global recordIdType
String
attributeStore
Attribute store key if needed
Signature
global attributeStoreType
String
dataService
Data service, typically ‘DEFAULT’
Signature
global dataServiceType
String
follow
Follow, typically ‘Contact’
Signature
global followType
String
dataTemplateName
Data template name
Signature
global dataTemplateNameType
String
classification
Classification of template/document. Used to control access
Signature
global classificationType
String
GetAttributeDocumentParams Class
Wrapper class to embed all necessary data for getting a document from an attribute store key. It is used as parameter to the methods getAttributeDocument() and getAttributeDocumentDyn().
Fields
attributeStoreKeyId
Attribute store key id
Signature
global attributeStoreKeyIdType
String