- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 05-13-2021 08:21 AM
This functionality explains how the users can subscribe to a ticket to get updates on that particular ticket through portal and how it can be configured.
In this article we have used Incident ticket as an example allowing users to subscribe to the ticket based on certain conditions.
Required Configurations:
1.Events
2.A custom field
3.Custom Widget for Subscription form on portal
4.Notifications
5.Business Rule
6.Simple list widget for subscriptions
1. Events:
As it's mentioned above, create three events as follows on incident table
System Policy--> Events-->Registry-->new
-
-
- incident.subscribe.progress
- incident.subscribe.hold
- incident.subscribe.close
-
2. A Custom Field: list type field called 'subscribed users' on incident
3. Custom Widget:
-
-
- Create new widget called 'Incident Subscription'
- Refer attached update set for widget code :incident_subscription.xml
- add the widget below the incident form in portal -->ctrl+right click-->search widgets-->Incident subscription-->drag it and place in below container under incident form
-
4. Notifications:
create 3 different notifications on incident table for each event
-
-
- Incident WorkInProgress- Subscription
-
When to Send :
Who will receive:
What it will contain:
Mail Scripts:
1.incident_subscription_user
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var nGr = new GlideRecord('sys_user');
nGr.addNotNullQuery('email');
nGr.addQuery('sys_id', event.parm1);
//nGr.addQuery('notification', '0c2bd5112f3b2410efa5f5ecf699b60a');
nGr.query();
if (nGr.next()) {
template.print("Hello"+ " "+nGr.name+",");
}
})(current, template, email, email_action, event);
2.Incident_email_text
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var instanceURL = gs.getProperty('glide.servlet.uri')+"/cs";
var IncidentTicket = gs.getProperty('glide.servlet.uri')+"/cs?sys_id="+current.sys_id+"&view=sp&id=form&table="+current.getTableName();
template.print("For more options please follow the <a href=" +IncidentTicket+">Ticket</a> or log on to the <a href=" +instanceURL+">CS portal</a>");
})(current, template, email, email_action, event);
---------------------------------------------------------------------------------------------------------------------
-
-
- Incident On Hold - Subscription
-
When to send
Who will receive - refer the above screenshot of who will receive from Incident Open - Subscription Notification.
What it will contain:
-------------------------------------------------------------------------------------------------------------------
-
-
- Incident Ticket close - Subscription
-
When to send:
Who will receive - refer the above screenshot of who will receive from Incident Open - Subscription Notification.
What it will contain:
5.Business Rule:
Name: Incident subscription notify
For code, refer attached update set:incident_subscription.xml
6.Simple list widget for subscriptions
On Portal home page: ctrl+right click -->page in designer
On right side --> filter widgets--> search for simple widget, drag and place it inside container
Click on edit pencil icon and fill details as shown in below screenshot
Right click on symbol near to Instance of Simple list in above screenshot and select open in platform.
Under Presentation section , give Title as 'Incidents you are subscribed to' and save it.
Demo for Test Results:
1.The Widget will be displayed as shown in below screenshot
2.The default Incident State value is 'In Progress', the other options will be On Hold, Close.
3.select notify to this ticket button and click on subscribe button
Note: notify for similar tickets is a different functionality for which I will publish Part-2 article
4.Once we do subscribe, a new record gets created in Notification Subscriptions(sys_notif_subscription) table as shown below
5.When Incident state changes, the relevant event gets triggered via business rule and a notification gets triggered to the subscribed user
6.On portal side, under incident form subscribe button and attributes will be hidden as the current user already subscribed and unsubscribe button will be visible
If user click on unsubscribe button, the record will be deleted from notification subscriptions table for that particular user for the current ticket, the list field stores all the users who subscribed to the ticket.
The simple widget shows list of incidents logged in user subscribed to in portal home page as shown below:
If you find this article helpful, please mark it as helpful and bookmark it for future reference.
Happy Learning 🙂
- 1,520 Views