Skip to main content
Skip table of contents

createRequestItems

This method is used to create multiple items for a DocuFetch Request

Returns: List of created DocuFetchRequestItemInfo objects.

List<cg.DocuFetchRequestItemInfo> createRequestItems (List<cg.DocuFetchRequestInfo> requestItemInfoList)

JAVA
// Create Multiple Request Items
Id sampleRequestId = 'a1bXXXXXXXXXXXXXXX'; // e.g. DocuFetch request ID
for(Integer i=0; i<5; i++){
    cg.DocuFetchRequestItemInfo item = new cg.DocuFetchRequestItemInfo();
    item.name = 'Item ' + i; // mandatory
    item.itemType = 'New Upload'; // mandatory
    item.itemTypeOptions = 'pdf,jpg,png'; // mandatory
    item.parentRequestId = sampleRequestId; // mandatory, it can be different for each request item
    item.type = 'item';
    item.details = new Map<String, Object>{
        'uploadType' => 'initialUpload',
        'minFilesUpload' => 1,
        'maxFilesUpload' => '5',
        'uploadInstructions' => 'Please upload the required documents.'
    };
    batchItemList.add(item);
}
List<cg.DocuFetchRequestItemInfo> batchItemList = cg.DocuFetchTools.createRequestItems(batchItemList);

for(cg.DocuFetchRequestItemInfo item: batchItemList){
    if(item.result){
        System.debug('Item creation succeeds: ' + item);
    }
    else {
        System.debug('Item creation fails: ' + item.message);
    }
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.