Ui page in UI Action

Simona3
Tera Contributor

i am filling some mandatory field on record after that click on UI Action.

In UI Action ,by using UI Page i have option to select any value as i click on ok button it shows the error. 

'Leave Site? Changes you made may not be saved' .

 

I don't want this Leave site? alert.

How can i achieve this

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Simona3 

that's browser behavior.

Whenever you fill something and moving away from that page then it will show that message

Why are you using UI page from UI action?

What's your business requirement here?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

when click on ui Action:GlideDialogWindow is open for user to select one field .

 

Business requirement is when click on button1 of the record should save the change value of record and from ui page selected value should be updated on related record field.

 

I want that when click on button1 show dialog window then i will slect the value after click on ok button save and update the current record without leave site error message

@Simona3 

this is not going to happen.

If user enters something in some field and opens the UI page and UI page is trying to reload the form from OK button then this will happen

Share your UI page code

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

 

function showAssign() {
    if (g_form.getValue('u_plan_year') == "" || g_form.getValue('u_plan_quarter') == "" || g_form.getValue('u_reviewer') == "" || g_form.getValue('u_plan_month') == "" || g_form.getValue('u_reviewing_team') == "") {
        g_form.addErrorMessage("Plan Year/Quarter/Month,Reviewing Team and Reviewer cannot be blank!");
       
    } else {
        var planyear = g_form.getValue('u_plan_year');
        var planquarter = g_form.getValue('u_plan_quarter');
        var planmonth = g_form.getValue('u_plan_month');
        var reviewer = g_form.getValue('u_reviewer');
        var revteam = g_form.getValue('u_reviewing_team');
        var date1 = g_form.getValue('u_proposed_date_1');
        var date2 = g_form.getValue('u_proposed_date_2');
        var date3 = g_form.getValue('u_proposed_date_3');
        var sysId = g_form.getUniqueValue();
        if (date1 || date2 || date3) {
          //  alert('test2');
            var gdw = new GlideDialogWindow('confirm_page');
            gdw.setSize(750, 300);
            gdw.setPreference('plan_year', planyear);
            gdw.setPreference('plan_quarter', planquarter);
            gdw.setPreference('plan_month', planmonth);
            gdw.setPreference('reviewer', reviewer);
            gdw.setPreference('revteam', revteam);

 

            gdw.render();
        } else {
          //  alert('test3');
            newAA(sysId);
        }
    }

 

    function newAA(sysId) {
        var ga = new GlideAjax('Proposeddaylogic'); //Scriptinclude
        ga.addParam('sysparm_name', 'getnewAssessment'); //Method
        ga.addParam('sysparm_sysId', sysId); //Parameters
        ga.addParam('sysparm_planyear', planyear); //planyear
        ga.addParam('sysparm_planquarter', planquarter);
        ga.addParam('sysparm_planmonth', planmonth);
        ga.addParam('sysparm_reviewer', reviewer);
        ga.addParam('sysparm_revteam', revteam);
        ga.getXMLAnswer(getResponse);
        function getResponse(response) {
            //alert(response);
            g_form.addInfoMessage(response + ' is Assigned.');
        }

 

    }
}
 
 
Is it possible to achieve in some other way to avoid the alert