Updating activity template to add custom note type on the Activity tab
For Progressive Web App (PWA) tickets, the following customizable activity templates are provided (in HTML and .JSON formats):
- SHR_SV_Activity_Template.html (for work orders)
- SHR_SV_Activity_Template_HPD.html (for incidents)
- SHR_SV_Activity_Data_Template.json (for all other modules except incidents and work orders)
To update the activity template for customizing activity notes
As an administrator, you can update the activity templates to customize the activity notes and display custom note type in the activity notes. You can display custom note types by modifying either the HTML templates, or by modifying the HTML and JSON templates.
To display custom note types by modifying the HTML activity templates
Add the following code in SHR_SV_Activity_Template.html (for work orders) and SHR_SV_Activity_Template_HPD.html (for incidents):
var workLogType = `$<field ID>$`;- Find the following code:
messageText = peopleText + valField_0 + ' ' + addedNoteStr + '</br>' + generateLinkForURL(valField_1) - Replace it with the following code:
messageText = peopleText + valField_0 + ' ' + addedNoteStr + ' ( ' + notetype + ' )' + '</br>' + generateLinkForURL(valField_1); - Add the activity template files in Mid Tier.
After performing these steps, you can see the following update in a note on the Activity tab:
To display custom note types by updating the HTML and JSON activity templates
Add the following code in SHR_SV_Activity_Template.html and SHR_SV_Activity_Template_HPD.html:
var notetype = `$<field ID>$`;In the SHR_SV_Activity_Data_Template.json file, search for the following code:
"TEXT_MESSAGES": {
"ADDED_NOTES": "added a note",
"SHOW_MORE": "Show more",
"SHOW_LESS": "Show less",
"SYSTEM_GENERATED": "System",
"DAYS": "Day(s)",
"HOURS": "Hour(s)",
"MINUTES": "Minute(s)",
"PRIVATE": "Private",
"PUBLIC": "Public"
},- In the ADDED_NOTES line, replace "added a note" with "added a #noteType# note".
Add this code in SHR_SV_Activity_Template.html and SHR_SV_Activity_Template_HPD.html:
var noteTypeToken = addedNoteStr.match(/(\#noteType\#)/g);
if (noteTypeToken && noteTypeToken.length > 0) {
addedNoteStr = addedNoteStr.replace(noteTypeToken, notetype);
}else{
addedNoteStr = addedNoteStr.replace(noteTypeToken, "");
}- Add the activity template files in Mid Tier.
After performing these steps, you can see the following update in a note on the Activity tab:
To add activity template in Mid Tier and sync cache
- Log in to Mid Tier as an administrator.
- Navigate to the AR System Resource Definitions Items form by entering the form name in the Mid Tier URL.
- Click New search.
- Enter template name, select Type as Template, and Mime Type as text/html. Click Search.
- Select the required template and click Add button.
- Click Replace button to add the updated template.
- Click Choose field and select the updated template.
- Click Save.
- After the updated template has been uploaded, log in to the Mid Tier Configuration console.
- Click Cache Settings > Sync Cache.
Once the cache is synced, you can validate the changes on the PWA screens.