diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/CSS.js b/Modern Development/Service Portal Widgets/My Mentioned Items/CSS.js new file mode 100644 index 0000000000..4f2b212d95 --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/CSS.js @@ -0,0 +1,15 @@ +/* +list css to show border-bottom and padding. +*/ +li{ + padding: 1.2rem 0; + border-bottom: .1rem solid #DADDE2; + list-style:none; +} + +/* +set background color of widget to white. +*/ +.main-cont{ + background:#ffffff; +} diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/HTML.js b/Modern Development/Service Portal Widgets/My Mentioned Items/HTML.js new file mode 100644 index 0000000000..db385f096e --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/HTML.js @@ -0,0 +1,14 @@ +
+
+

${My Mentions}

+
+
+
+
    +
  • + ${You have been mentioned in }{{item.record}} ${by }{{item.user_from}} +
  • +
+
+
+
diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/README.md b/Modern Development/Service Portal Widgets/My Mentioned Items/README.md new file mode 100644 index 0000000000..753a233746 --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/README.md @@ -0,0 +1,12 @@ +**How to use** +1. Add this widget to portal homepage or any other page. +2. It will display the top 5 records where user is mentioned in. +3. It will also display the user who has mentioned the logged in user. + +**Use Case** +1. User will receive the mentioned items on portal homepage. +2. User can directly go to the record and reply. +3. The link will land the user on tickets page. + +my mentions + diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/server script.js b/Modern Development/Service Portal Widgets/My Mentioned Items/server script.js new file mode 100644 index 0000000000..6c4490547b --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/server script.js @@ -0,0 +1,21 @@ +(function() { + /* + This code will display the records wher user is mentioned in (@user in Jurnal fields). + This will also provide the link to record. + Only top 5 mentions will be displayed. + */ + data.mentionArr = []; // array to store mentions. + var mentionRec = new GlideRecord('live_notification'); + mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records + mentionRec.orderBy('sys_created_on'); // get by created date. + mentionRec.setLimit(5); + mentionRec.query(); + while (mentionRec.next()) { + tempval = {}; // temp object. + tempval.record = mentionRec.getValue('title'); + tempval.user = mentionRec.user.name.toString(); + tempval.user_from = mentionRec.user_from.name.toString(); + tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table'); + data.mentionArr.push(tempval); + } +})();