Tutorial: embed attached images in the activity history of any ticket. (Fuji)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2015 03:00 PM
The Activity Formatter as of today is primarily geared for a text-only discussion, but it is possible to embed small snippets of HTML inside of the activity detail of any given ticket. This can be done by surrounding each HTML snippet with encapsulating "[code]" "[/code]" tags. Utilizing that feature, 2 additional Business Rules, and a Dictionary modification we will end up with a result that looks like the following:
Step 1
Right-click on the "Work notes" label and select "Configure Dictionary.
Change the "Type" from Journal to HTML and save your changes.
Step 2
Create the two business rules as shown below. Make sure to activate them.
Business Rule: "Clear out work_notes field onDisplay"
- TABLE: task
- WHEN: display
- SCRIPT:
function onDisplay(current, g_scratchpad) {
// Clears out work_notes field to emulate journal-like behavior with HTML field.
current.work_notes = "";
}
Business Rule "Wrap work_notes with code tag"
- TABLE: task
- WHEN: before insert or update
- SCRIPT:
function onBefore(current, previous) {
// If no opening [code] tag found, wrap it.
var note = current.work_notes + "";
if (note.indexOf("[code]") == -1) {
var wrappedNote = "[code]" + note + "[/code]";
note = wrappedNote;
}
current.work_notes = note;
// Workaround to inject style attribute into image tags.
var note = current.work_notes + "";
var noteStyle = note.replace("\<img style\=\"", "\<img style\=\"display\: block\; ");
if (note != noteStyle) {
current.work_notes = noteStyle;
}
}
Feel free to comment here if you have any questions or have found even better ways of accomplishing this! As always, please thoroughly test these customizations in each of your sub-production environments prior to implementation in your production environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2015 03:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2015 01:38 PM
Changing the type of the work_notes field from Journal to HTML will cause a change in what the "Comments and Work notes" field displays in a list. Namely, no work_notes will display in this column on a list after changing work_notes to a HTML field.