Using casefile templates

In the previous guides, we've been focusing on building casefiles more or less from scratch, defining the relationship between casefile, document and signers in detail.

Penneo comes with templates for hundreds of different workflows. Templates define a set of document types and signer types, and defines who signs what, and in which order.

In the Penneo terminology, we call these Casefile Types, and they get chosen on casefile creation, like so:

// Create a new case file

GET <<penneo_api_base_url>>/casefile/casefiletypes

// Get the case file templates available to the authenticated user

POST /api/v1/casefiles
{
  "title":"Demo case file",
  "caseFileTypeId":<your casefile type id>
}
// Create a new case file

var myCaseFile = new CaseFile("Demo case file");

// Get the case file templates available to the authenticated user
var availableTemplates = myCaseFile.GetTemplates().Objects;

// Assign the first list item as the case file template
myCaseFile.SetCaseFileTemplate(availableTemplates.First());

// You're done
myCaseFile.Persist();
// Create a new case file

$myCaseFile = new CaseFile();
$myCaseFile->setTitle('Demo case file');

// Get the case file templates available to the authenticated user
$templates = $cf->getCaseFileTemplates();

// Assign the first list item as the case file template
$myCaseFile->setCaseFileTemplate($templates[0]);

// You're done
CaseFile::persist($myCaseFile);

NOTE: If you use case file types, you don't have to create signature lines yourself. Penneo will take care of that as long as you set the correct document types and signer roles.