MFAPI_WebEditor Class

Namespace

mfwe

Methods

getInstance()

Get singleton instance of this class

Signature

global static MFAPI_WebEditor getInstance()

Return Type

MFAPI_WebEditor

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

NameTypeDescription
paramsGetMetaforceTemplatesParamsParameters 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

NameTypeDescription
paramsGetMetaforceTemplatesParamsParameters 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

NameTypeDescription
paramsDynamoSearchParamsParameters 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

NameTypeDescription
paramsDynamoSearchParamsParameters 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

NameTypeDescription
paramsArchiveSearchParamsParameters 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

NameTypeDescription
paramsArchiveSearchParamsParameters 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

NameTypeDescription
paramsArchiveSearchParamsParameters 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

NameTypeDescription
paramsArchiveSearchParamsParameters 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

NameTypeDescription
paramsUpdateMetadataParamsParameters 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

NameTypeDescription
paramsUpdateMetadataParamsParameters 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

NameTypeDescription
paramsArchiveUpdateMetadataParamsParameters 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

NameTypeDescription
paramsArchiveUpdateMetadataParamsParameters 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

NameTypeDescription
paramsArchiveUploadParamsParameters 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

NameTypeDescription
paramsArchiveUploadParamsParameters 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

NameTypeDescription
paramsGetDocumentParamsParameters 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

NameTypeDescription
paramsGetDocumentParamsParameters 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

NameTypeDescription
paramsPrintOrderBatchParamsParameters 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

NameTypeDescription
paramsPrintOrderBatchParamsParameters 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

NameTypeDescription
paramsSaveDocumentParamsParameters 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

NameTypeDescription
paramsSaveDocumentParamsParameters 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

NameTypeDescription
paramsSaveDocumentParamsParameters 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

NameTypeDescription
paramsSaveDocumentParamsParameters 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

NameTypeDescription
paramsCreateDocumentParamsParameters 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

NameTypeDescription
paramsCreateDocumentParamsParameters 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

NameTypeDescription
paramsCreateDocumentXmlParamsParameters 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

NameTypeDescription
paramsCreateDocumentXmlParamsParameters 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

NameTypeDescription
paramsCreatePdfParamsParameters 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

NameTypeDescription
paramsCreatePdfParamsParameters 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

NameTypeDescription
paramsGetTemplateParamsParameters 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

NameTypeDescription
paramsGetTemplateParamsParameters 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

NameTypeDescription
paramsGetSobjectRecordAsKeyValueDataParamsparameters 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

NameTypeDescription
paramsGetSobjectRecordAsKeyValueDataParamsparameters 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

NameTypeDescription
paramsGetSobjectChildRecordsAsKeyValueDataParamsparameters 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

NameTypeDescription
paramsGetSobjectChildRecordsAsKeyValueDataParamsparameters 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

NameTypeDescription
paramsWebEditDocumentParamsparameters 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

NameTypeDescription
paramsWebEditDocumentParamsparameters 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

NameTypeDescription
paramsWebEditDocumentStandardParamsparameter 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

NameTypeDescription
paramsWebEditDocumentStandardParamsparameter 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

NameTypeDescription
paramsGetAttributeDocumentParamsParameters 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

NameTypeDescription
paramsGetAttributeDocumentParamsParameters 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 metaLogic
Type

String

Constructors

GetMetaforceTemplatesParams()
Signature
global GetMetaforceTemplatesParams()

GetMetaforceTemplatesParams(metaLogic)
Signature
global GetMetaforceTemplatesParams(String metaLogic)
Parameters
NameTypeDescription
metaLogicStringString 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
NameTypeDescription
metaLogicStringString 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 top
Type

Integer


resultColumns

List of strings containing the names of the columns to return.

Signature
global resultColumns
Type

List<String>


sorters

List of sorters to use when sorting the result.

Signature
global sorters
Type

List<MFWED_ApiTypes.SorterCls>


whereConditions

List of where conditions to use when filtering the result.

Signature
global whereConditions
Type

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
NameTypeDescription
columnStringString containing the name of the column to sort by.
sortOrderStringString 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
NameTypeDescription
topIntegerInteger 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
NameTypeDescription
resultColumnFieldStringString 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
NameTypeDescription
resultColumnsList<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
NameTypeDescription
valueStringString containing the value to compare with.
comparerStringString containing the comparer to use (‘EQ’, ‘NE’, ‘GT’, ‘LT’, ‘GE’, ‘LE’).
columnStringString containing the name of the column to compare with.
chainerStringString 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 searchSpec
Type

List<MFWED_ApiTypes.SearchSpec>


chainer

Comparator between search conditions ‘AND’ or ‘OR’.

Signature
global chainer
Type

String


sortOrder

Sort Order (‘ASC’ or ‘DESC’).

Signature
global sortOrder
Type

String


sortByKey

Name for Metaforce metadata field to use for sorting like: ‘ArchiveDate’.

Signature
global sortByKey
Type

String


skip

Number of records to skip e.g. offset, 0 = No offset.

Signature
global skip
Type

Integer


take

Number of records to return.

Signature
global take
Type

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
NameTypeDescription
specMFWED_ApiTypes.SearchSpecSearch 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
NameTypeDescription
keyStringA key to search for.
valueStringA value to search for.
comparerStringA 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
NameTypeDescription
chainerStringString 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
NameTypeDescription
sortOrderStringString 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
NameTypeDescription
sortByKeyStringString 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
NameTypeDescription
skipIntegerInteger 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
NameTypeDescription
takeIntegerInteger 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 jobId
Type

Integer


docId

Integer containing the document identification.

Signature
global docId
Type

Integer


updateColumns

Map containing the new metadata key/value pairs.

Signature
global updateColumns
Type

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 searchId
Type

String


partitionKey

String containing the partition key.

Signature
global partitionKey
Type

String


updateColumns

Map containing the new metadata key/value pairs.

Signature
global updateColumns
Type

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 retentionPolicy
Type

String


metadata

Map containing the metadata key/value pairs. ‘PARTITIONKEY’ is mandatory key/value pair!

Signature
global metadata
Type

Map<String,String>


file

String containing the base64 encoded file contents.

Signature
global file
Type

String


contentType

String containing the content type of the file. Typically ‘application/pdf’.

Signature
global contentType
Type

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 jobId
Type

String


docId

Integer containing the document identification.

Signature
global docId
Type

String


searchId

String containing the search identification.

Signature
global searchId
Type

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 query
Type

String


batchSize

Set to custom value if query is set to custom query. Default value is 4

Signature
global batchSize
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


fileName

Description of template

Signature
global fileName
Type

String


sObjectName

SObjectname, typically ‘Contact’

Signature
global sObjectName
Type

String


recordId

Salesforce record id

Signature
global recordId
Type

String


distributionMethod

Method of distribution, typically ‘Archiving’ or ‘LocalPrint’

Signature
global distributionMethod
Type

String


attributeStoreKey

Attribute store key if needed

Signature
global attributeStoreKey
Type

String


dataService

Name of data service, typically ‘DEFAULT’

Signature
global dataService
Type

String


follow

What SObjecttype to send to (recipient), typically ‘Contact’ or ‘Account’

Signature
global follow
Type

String


dataTemplateName

Name of data template if applicable

Signature
global dataTemplateName
Type

String


classification

Classification of template/document. Used to control access

Signature
global classification
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


distributionMethod

Method of distribution, typically ‘Archiving’ or ‘LocalPrint’

Signature
global distributionMethod
Type

String


attributeStoreKey

Attribute store key if needed

Signature
global attributeStoreKey
Type

String


nodes

Nodes to use for creating document

Signature
global nodes
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


distributionMethod

Method of distribution, typically ‘Archiving’ or ‘LocalPrint’

Signature
global distributionMethod
Type

String


attributeStoreKey

Attribute store key if needed

Signature
global attributeStoreKey
Type

String


xml

XML string to use for creating document with DATA-tag

Signature
global xml
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


attributeStoreKey

Attribute store key if needed

Signature
global attributeStoreKey
Type

String


nodes

Nodes to use for creating document

Signature
global nodes
Type

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 templateName
Type

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 sObjectName
Type

String


recordId

Salesforce record id

Signature
global recordId
Type

Id

GetSobjectChildRecordsAsKeyValueDataParams Class

Wrapper class to embed all necessary data for reading child records with optional filter

Fields

sObjectName

SObjectname, typically ‘Contact’

Signature
global sObjectName
Type

String


parentFieldName

Parent field name, typically ‘AccountId’

Signature
global parentFieldName
Type

String


recordId

Salesforce record id

Signature
global recordId
Type

Id


filter

SQL where clause to filter child records. Typically ‘IsActive__c = TRUE’

Signature
global filter
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


fileName

Description of template

Signature
global fileName
Type

String


sObjectName

SObjectname, typically ‘Contact’

Signature
global sObjectName
Type

String


recordId

Salesforce record id

Signature
global recordId
Type

String


attributeStore

Attribute store key if needed

Signature
global attributeStore
Type

String


classification

Classification of template/document. Used to control access

Signature
global classification
Type

String


xmlString

XML string to use for creating document with DATA-tag

Signature
global xmlString
Type

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 metaFile
Type

String


documentName

Name of template

Signature
global documentName
Type

String


fileName

Description of template

Signature
global fileName
Type

String


sObjectName

SObjectname, typically ‘Contact’

Signature
global sObjectName
Type

String


recordId

Salesforce record id

Signature
global recordId
Type

String


attributeStore

Attribute store key if needed

Signature
global attributeStore
Type

String


dataService

Data service, typically ‘DEFAULT’

Signature
global dataService
Type

String


follow

Follow, typically ‘Contact’

Signature
global follow
Type

String


dataTemplateName

Data template name

Signature
global dataTemplateName
Type

String


classification

Classification of template/document. Used to control access

Signature
global classification
Type

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 attributeStoreKeyId
Type

String