Skip to content

Commit e5fad12

Browse files
authored
My mentions widget (#2419)
* Add script to display user mentions in records This script retrieves and displays the top 5 records where the user is mentioned, including links to those records. * Add CSS styles for My Mentioned Items widget * Add HTML structure for My Mentioned Items widget * Add usage instructions and use case for widget Provides instructions on how to use the widget and its use cases.
1 parent 93e1dbb commit e5fad12

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
list css to show border-bottom and padding.
3+
*/
4+
li{
5+
padding: 1.2rem 0;
6+
border-bottom: .1rem solid #DADDE2;
7+
list-style:none;
8+
}
9+
10+
/*
11+
set background color of widget to white.
12+
*/
13+
.main-cont{
14+
background:#ffffff;
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div class="main-cont">
2+
<div class="panel-heading b-b">
3+
<h2 class="panel-title ng-binding">${My Mentions}</h2>
4+
</div>
5+
<div>
6+
<div class="page-container">
7+
<ul>
8+
<li ng-repeat="item in data.mentionArr">
9+
<span>${You have been mentioned in }</span><a href = {{item.url}} target="_blank">{{item.record}}</a> <span>${by }{{item.user_from}}</span>
10+
</li>
11+
</ul>
12+
</div>
13+
</div>
14+
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**How to use**
2+
1. Add this widget to portal homepage or any other page.
3+
2. It will display the top 5 records where user is mentioned in.
4+
3. It will also display the user who has mentioned the logged in user.
5+
6+
**Use Case**
7+
1. User will receive the mentioned items on portal homepage.
8+
2. User can directly go to the record and reply.
9+
3. The link will land the user on tickets page.
10+
11+
<img width="338" height="957" alt="my mentions" src="https://github.com/user-attachments/assets/68499e33-8d57-4c08-8228-b152203fbf4e" />
12+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(function() {
2+
/*
3+
This code will display the records wher user is mentioned in (@user in Jurnal fields).
4+
This will also provide the link to record.
5+
Only top 5 mentions will be displayed.
6+
*/
7+
data.mentionArr = []; // array to store mentions.
8+
var mentionRec = new GlideRecord('live_notification');
9+
mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records
10+
mentionRec.orderBy('sys_created_on'); // get by created date.
11+
mentionRec.setLimit(5);
12+
mentionRec.query();
13+
while (mentionRec.next()) {
14+
tempval = {}; // temp object.
15+
tempval.record = mentionRec.getValue('title');
16+
tempval.user = mentionRec.user.name.toString();
17+
tempval.user_from = mentionRec.user_from.name.toString();
18+
tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table');
19+
data.mentionArr.push(tempval);
20+
}
21+
})();

0 commit comments

Comments
 (0)