Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to show message in portal banner

chaitanya34
Tera Contributor

Hi Team,

 

How to show message in top of service portal, please find below image I created custom widget, but that meesage is showing in top of search bar, I need message in top of portal or after image

chaitanya34_0-1720161433688.png

Widget code :

<div ng-if="isVisible" class="alert alert-info">
<button type="button" class="close" ng-click="dismiss()">
<span>&times;</span>
</button>
<p>Welcome, your company is: {{::company}}</p>
</div>

 

Server side : 

 

(function() {
    data.userCompany = '';
    data.isCompanyActive = false;
    var userSysId = gs.getUserID();
    var userGR = new GlideRecord('sys_user');
    if (userGR.get(userSysId) && userGR.company) {
        var companyGR = new GlideRecord('core_company');
        if (companyGR.get(userGR.company) && companyGR.vendor == true) {
            data.userCompany = companyGR.name.toString();
            data.isCompanyActive = true;
        }
    }
})();
 
Client controller :
 
function($scope) {
    $scope.company = $scope.data.userCompany;
    $scope.isVisible = $scope.data.isCompanyActive;

    $scope.dismiss = function() {
        $scope.isVisible = false;
    };
}
5 REPLIES 5

follow the below steps to achieve this

1.Clone Header Menu widget - Add Welcome message and CSS  

2. create new menu page

3. add cloned widget the new menu page

4. add menu page to portal.

 

I have tried in PDI , this is working for me, here I have only using logged in user name in msg

 

Trupti94_0-1720173460748.png

 

let me know if you have any questions , Thanks!