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)
// 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);
}
}