createRequest
This method is used to create a DocuFetch Request. Items will need to be added to the Request using createRequestItem or createRequestItems.
Returns: The created DocuFetchRequestInfo
object. The result
field represents the result of the create operation. If the result
is false
, the error message will be in the message
field.
cg.DocuFetchRequestInfo createRequest (cg.DocuFetchRequestInfo requestInfo)
// Create a Request
Id sampleParentId = '001XXXXXXXXXXXXXXX'; // e.g. Account or Case ID
// It's the relationship name between cg__SDriveDocumentIntakeRequest__c and the object you want to use DocuFetch with.
String relationshipName = 'Your_Relationship__r'; // e.g. cg__Account__r
String fileObjectName = 'YourFileObjectName'; // e.g. AccountFile__c
String fileObjectPrefix = 'YourPrefix'; // e.g. cg__
cg.DocuFetchRequestInfo newRequest = new cg.DocuFetchRequestInfo();
newRequest.parentId = sampleParentId; // mandatory field
newRequest.name = 'Sample DocuFetch Request'; // mandatory field
newRequest.description = 'Sample DocuFetch Request'; // optional field
newRequest.fileObjectName = fileObjectName; // mandatory field
newRequest.fileObjectPrefix = fileObjectPrefix; // mandatory field
newRequest.relationshipName = relationshipName; // mandatory field
cg.DocuFetchRequestInfo createdRequest = cg.DocuFetchTools.createRequest(newRequest);
System.debug('Created Request: ' + createdRequest);