For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Testing

This article will cover common and unique use cases that can be tested with SDK and through the Developer Console.

S-Docs UserInput

Opportunity oppObj = [SELECT Id FROM Opportunity WHERE Id = 'BASE_RECORD_ID' LIMIT 1];
SDOC__SDTemplate__c template = [SELECT Id FROM SDOC__SDTemplate__c WHERE Name = 'TEMPLATE_NAME' LIMIT 1];

String generatedSDoc;
SDOC.GenerationOptions genOptions = new SDOC.GenerationOptions();

Map<String, String> userInput = new Map<String, String>{
    'Field_1' => 'Value 1',
    'Field_2' => 'Value 2'
        };
            genOptions.documentOptions = new SDOC.DocumentOptions(userInput);

generatedSDoc = SDOC.DocumentSDK.generateDocument(template.Id , oppObj.Id, genOptions);

SDBatch: 2 templates, X records

Set<Id> templateList = new Set<Id>();

List<SDOC__SDTemplate__c> templates = [SELECT Id FROM SDOC__SDTemplate__c WHERE Name in ('Opportunity Template','Opportunity Template TWO')];

for (SDOC__SDTemplate__c template : templates) {
templateList.add(template.Id);   
}

List<Opportunity> opps = [SELECT Id FROM Opportunity where name like '%Airport%'];
List<Id> objs = new List<Id>();
for (Opportunity opp : opps) {
    objs.add(opp.Id);
}

Id asyncId = SDOC.DocumentSDK.generateDocsInBatch(objs, templateList, 2);

CombineAll: 2 templates, X records

Last updated

Was this helpful?