ffcpm.CreatePlaybookFromTemplateServiceglobal with sharing class CreatePlaybookFromTemplateService Used to create playbooks from templates, exposes the global API for mass creation of playbooks from templates. MethodscreatePlaybooksFromTemplatesglobal static List<ffcpm.CreatePlaybookFromTemplateResponse> createPlaybooksFromTemplates(List<ffcpm.CreatePlaybookFromTemplateRequest> requests) Used to create multiple playbooks from templates using a list of requests. Input Parameters
Return ValueList<CreatePlaybookFromTemplateResponse> Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Make a list of requests to call the API with. final List<ffcpm.CreatePlaybookFromTemplateRequest> requests = new List<ffcpm.CreatePlaybookFromTemplateRequest>(); // Provide IDs for relevant templates (acquired via a SOQL call or some other means). final Id templateId = 'a2f53000000Fy8TAAS'; final Id templateId2 = 'a2f53000000Fy8VAAS'; // Make a map of fields to populate on the new playbook and values to populate them with. final Map<String, Object> fieldsToPopulate1 = new Map<String, Object>{ 'Name' => '1st API-generated playbook', 'pse__Start_Date__c' => '2021-07-02T00:00:00.000Z' }; // Make a request by providing a template ID, the ‘fieldsToPopulate’ map and the optional boolean dictating whether or not to ‘clone PTAs’. This boolean defaults to true. final ffcpm.CreatePlaybookFromTemplateRequest request1 = new ffcpm.CreatePlaybookFromTemplateRequest( templateId, fieldsToPopulate1, false ); requests.add(request1); // N.B.: This service copies all related records across from the template to the new playbook (project tasks, project task assignments, team and team memberships). We currently only support the omission of PTAs. // Continue constructing a list of requests to suit your requirements. final Map<String, Object> fieldsToPopulate2 = newMap<String, Object>{ 'Name' => '2nd API-generated playbook', 'pse__Start_Date__c' => '2021-08-10T00:00:00.000Z' }; final ffcpm.CreatePlaybookFromTemplateRequest request2 = new ffcpm.CreatePlaybookFromTemplateRequest( templateId2, fieldsToPopulate2 ); requests.add(request2); // Call the global service with the list of requests. final List<ffcpm.CreatePlaybookFromTemplateResponse> responses = ffcpm.CreatePlaybookFromTemplateService.createPlaybooksFromTemplates(requests); |