The snippet manager in the execution engine provides lots of different snippets that help you to create tasks, change phase, and other common activities you may wish to do within a workflow. This section shows how to create a task from an ee plan with a set of action plan items.
- In the plan editor go to the step function where you wish to create the task. In our sample task this is the 'createSimpleTask1'.
- Use a snippet to create your task.
- Select the taskFull Snippet and insert it into your function (the //code indicates where to insert your step details.)
- Lets take a walk through what this snippet is doing:
Snippet Component Description Action Plan Items This first section is building up the action plan items that will appear against the task.
Each section creates one checklist item - there are several more detailed snippets around action plan items that can be viewed in the snippet manager.
The WithDescription provides the name of the checklist item
AddCheckbox indicates that a user will need to check off this item (optional)
Markrequired indicates it is a required field (optional)
WithCallToAction indicates there will be a button next to the action plan item that will help the user to navigate through the UI. The menuId will be replaced with the menu id for the item. There are several sample menu items in the snippet manager.
Task Creation There are a number of different task creation snippets within the system - it is worth familiarising yourself with these.
ForSharedo - this indicates the work type id the task should be linked to - this is often the work type id that has been placed in the context object e.g. ctx.sharedoId
WithTitle - the title of the task - this will appear in worklists
WithDescription - the description of the task
WithProcessTag - process tags are used to chain tasks or to identify a specific task created by a workflow. This is commented out in the snippet by the // characters.DueOn - sets the due date of the task - this is an example where the hours are specified as a number however there are numerous snippets around duedate which you should familiarise yourself with.
Assign - assign will assign a particular role on the task e.g primary-owner to a specific participant id. In our sample plan we are going to use the creator id we collected at the start of the process to assign this.
Assignment can also be done based on an allocation rule - there is a snippet for doing this - search 'allocation' in the snippet manager.
WithTag - sets a tag on the task that is visible through the UI, can be exposed in worklists and can be searched on in the chronology.
WithActionPlan - this adds the action plan items created earlier in the snippet onto the task.
Save - saves the task
If you want to use the task id later in the process you can either assign a task id directly or you can collect the returned id as part of the save. There are example of both these methods in the sample smart plan. - Go through and update your snippet to show the following information.
- Set call to action menu ids - these provide some common menu ids used in calls to action - these are also available as snippets.
/*************************************************************************************************** COMMON CALL TO ACTION BUTTONS - a list of common call to action buttons ***************************************************************************************************/ var callToActionParticipants = "21C72ED0-B468-470D-9DF5-77BDF9C212D7"; var callToActionMatter = "8058EDB8-65AA-4DF1-A628-CEF8BFFB3F62"; var callToActionPhaseTransition = "877814B8-9CA4-40F4-9C0A-232D46820743";
Action plan items -update you snippet to have the following entries
Task Builder - update your snippet to have the following entries.
Check the left hand column of the editor to make sure there are no crosses or warning signs - these indicate there is an error. If there are then hover over the sign to get more details of the issue