How to Create Alert / pop up window in service portal ?

Lakshmi51
Giga Guru

Hello All,

I have a widget which takes user name as one input and user id as an another input 

I have a requirement where i need to show a "pop up / alert " when the user name field and the user id field matches .

I have done the required validation in server script but no luck in populating the pop up window/alert.

Even we tried using bootstrap and searched in communities still am unable to find the solution.

Quick help will be highly appreciable.

 

 

 

4 REPLIES 4

Pratiksha Kalam
Kilo Sage

We tried this already but no luck

Madhav18
Mega Expert

Hi Lakhsmi,

Is it okay to use g_form.addInfoMessage or g_form.addErrorMessage for your requirement. If so we can use them in Client Script of widgets as below:

var g_form = $scope.page.g_form;

g_form.addInfoMessage("<text>");
g_form.addErrorMessage("<text>");


If it helps, please mark Correct and 👍 Helpful.


Thanks & Regards,
Madhav.

Sudhanshu Talw1
Tera Guru

Hi,

Try this with onChange:

var html='<h1>Matched</h1>'; 

if((g_form.getValue('user_name') === g_form.getValue('user_id)){

spModal.open({
title: "Test",
message: html,
buttons: [
{label:'OK', primary: true}
],
})..then(function(){
location.href="/sp?id=<required page>;//Comment out if this is onChange use if onSubmit()
});

}

 

Thanks

Sudhanshu