To create alert message popup in service portal

Dhivya10
Tera Contributor

I want to create a alert notification in service portal.. For example,

If I  click HR  means I need one alert message ..

 

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi,

create widget as below then you can add it to your portal using page designer.

In this example it will give the open incidents count and make changes as per you are requirement.

HTML:

<div   class="button-box" >
  <div>
   <button type="button" class="btn btn-primary" ng-click="open()">open</button>
  </div>
  </div>

Client Script:

function($scope) {
$scope.open = function(){
        alert($scope.data.task);
    }  
}

Server Script:

(function(){
 var incRec2 = new GlideRecord('incident');
    incRec2.addEncodedQuery('active=true');
    incRec2.query();
if(incRec2.next()){
data.task = "Total Open Incident are   :  "+incRec2.getRowCount();
    
}

})();

 

Hope it helps!!

Please Mark Correct, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

2 REPLIES 2

Pavankumar_1
Mega Patron

Hi,

create widget as below then you can add it to your portal using page designer.

In this example it will give the open incidents count and make changes as per you are requirement.

HTML:

<div   class="button-box" >
  <div>
   <button type="button" class="btn btn-primary" ng-click="open()">open</button>
  </div>
  </div>

Client Script:

function($scope) {
$scope.open = function(){
        alert($scope.data.task);
    }  
}

Server Script:

(function(){
 var incRec2 = new GlideRecord('incident');
    incRec2.addEncodedQuery('active=true');
    incRec2.query();
if(incRec2.next()){
data.task = "Total Open Incident are   :  "+incRec2.getRowCount();
    
}

})();

 

Hope it helps!!

Please Mark Correct, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi,

Please close the thread by Mark it  Correct/helpful, if this solves your issue.

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar