How to display an Info message in ServiceNow Portal

Priya131
Kilo Contributor

Hi,

How to display an info message for the service Now Portal when the incident form resolved state changes to the closed state.

Regards,

Priya

20 REPLIES 20

Hi,

Can you share your service portal form?

Also, put an alert message to check whether the script is running or not.

function onLoad() {
    //Type appropriate comment here, and begin script below

alert('script is running: '+g_form.getValue('state'));

    if (g_form.getValue('state') == 7) { // set the correct closed state value
alert('going inside te loop');
        g_form.addInfoMessage('The incident state is already closed');

    }

}

Hi balaji,

 

Here is the service portal form.

find_real_file.png

 

I need to display an info message when the end-user open's the closed incident.

 

find_real_file.png

 

 

Hi,

Can you confirm about the alert messages what it has returned?

Please use the below script,

function onLoad() {
    //Type appropriate comment here, and begin script below
    alert('table: ' + g_form.getTableName());
    alert('state: ' + g_form.getValue('state'));

    if (g_form.getValue('state') == 7) { // set the correct closed state value

        alert('going inside');

        g_form.addInfoMessage('The incident state is already closed');

    }

}

Hi, 

No alert messages were displaying in the ServiceNow portal.

 

 

Hi,

You are executing the script on the ticket widget and unfortunately, client script or UI policies will not work.

UI Policy and Client Script not working on "Ticket Form" [ticket] page on Service Portal - Known Err...