Skip to content

Commit 1e5fce5

Browse files
authored
Create script.js
1 parent f1473d6 commit 1e5fce5

File tree

1 file changed

+21
-0
lines changed
  • Modern Development/Service Portal Widgets/My Mentioned Items

1 file changed

+21
-0
lines changed
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 get display the records wher user is mentioned.
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)