NGLP - Configure To Display Template on Activity Card
Overview
When switching to the NGLP, the application will remain on the slow path if there are Template attributes on the Activity Card. In order to keep the application on the fast path, you will need to materialize the template by putting the data in a regular field.
Find the Template Fields
Run the following SQL to get a list of the Template attributes that may need to be reconfigured:
SELECT WORKFLOW = w.NAME,
d.WORKFLOW_ID,
DISPLAY_COLUMN = c.NAME,
ATTRIBUTE = ia.NAME,
ENTITY_TYPE = et.NAME,
ia.DEFINITION_DATA
FROM LEARNING_PLAN_ACTIVITY_DISPLAY d
JOIN WORKFLOW w on w.WORKFLOW_ID = d.WORKFLOW_ID
JOIN LEARNING_PLAN_ACTIVITY_DISPLAY_COLUMN c
ON c.LEARNING_PLAN_ACTIVITY_DISPLAY_COLUMN_ID = d.LEARNING_PLAN_ACTIVITY_DISPLAY_COLUMN_ID
JOIN ITEM_ATTRIBUTE ia ON ia.ITEM_ATTRIBUTE_ID = d.item_attribute_id
AND ia.ITEM_ATTRIBUTE_TYPE_ID = 22 -- Template
JOIN ENTITY_TYPE et on et.ENTITY_TYPE_ID = ia.ENTITY_TYPE_ID
Configuration Changes
For each Template Attribute:
Determine if the Template is on the Activity Instance or Activity (see Entity Type in the query)
Based on the Entity type, the configuration changes below will be on the Complete Activity Workflow or the Create Activity workflow, respectively
Determine if the Template outputs plain text or rich text (i.e. includes HTML markup) and if the output is a small or large amount of text.
Also, identify all of the input fields used by the template as you’ll need this for later steps.
Add a new field to store the data from the template.
Data Type:
Rich Text if there is any HTML markup, as long as does not use any custom styles or CSS
Short Text if the output is small and has no HTML markup
Long Text if the output is not small and or has HTML markup with styles or other CSS
Name: Similar to the template but suffix it with something like “Materialized” or “for LP Card” to the step where the template is calculated.
Label: Set to the same value as the label on the source template attribute.
Description: “This field is a materialized version of “[template_attribute_name]” to work around the NGLP activity card performance issue with Templates”
After it's added to a step, make the field read-only, and limit visibility to SysAdmins.
Note: If the template’s entity type was “Activity” you will not be able to limit the visibility to Sys Admins. Instead, you'll need to put it on a step that is not seen by practitioners or possibly put it on a dummy step. Having it displayed on at least one step is necessary to also show it on the LP Activity Card.
If the template outputs HTML with styles or other CSS, update the template attribute to include the following in the CSS. This is needed to prevent the <br> tags that are created by the Long Text attribute for line breaks in the HTML from impacting the viewable output.
div:has( .ASHI-PT-HT-table ) br{ display: none !important; }
Locate the step(s) on the workflow where each template input field is modified.
On each of those steps, update every action that saves data (generally all except the cancel action) to include an Update Workflow Instance Attribute Behavior to copy the data from the source template to the newly created field.
On all steps where the workflow may currently be, create a one-time automation that runs when the activity is incomplete, completed successfully, and completed unsuccessfully that performs the same behavior. Schedule it to run yearly on the next calendar day to update existing activities.
The next day, then update the Leaning Plan Display settings on the Activity Completion Workflow and replace the templated field with the new materialized text field after the automation runs.
Verify the data displays on the Learning Plan Activity Card as expected, with no change in content from the original Template.
Also, delete the one-time automation.
After the above steps have been done on UAT, you can perform the same steps on the live site, even before upgrading to a version that supports NGLP or turning on NGLP.