We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Issue with Zurich Version

Sathwik1
Tera Expert

Below onChange Client script is working in yokohoma but not in zurich, can someone please help me to understand on what is the issue?

 

function onChange(control, oldValue, newValue, isLoading) {

    if (isLoading || !newValue)
        return;

    var proceed = confirm("Please confirm");

    if (!proceed) {

        var ga = new GlideAjax('ScriptIncludeName');
        ga.addParam('sysparm_name', 'Function');
        ga.addParam('sysparm_abc', g_form.getValue('fieldname'));
        ga.getXML(function() {
            g_form.setValue('fieldname', '');
            g_form.reload();
            g_form.showFieldMsg(fieldname, 'cleared.', 'error');
        });
    }
}

 

@Ankur Bawiskar  @Its_Sagnic @Matthew_13 

3 REPLIES 3

Danish Bhairag2
Tera Sage

Hi @Sathwik1 ,

 

Can you try with the below code & see if it works?

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || !newValue) return;

    g_modal.confirm("Please confirm", function (confirmed) {

        if (!confirmed) {
            var ga = new GlideAjax('ScriptIncludeName');
            ga.addParam('sysparm_name', 'Function');
            ga.addParam('sysparm_abc', g_form.getValue('fieldname'));

            ga.getXMLAnswer(function () {
                g_form.setValue('fieldname', '');
                g_form.showFieldMsg('fieldname', 'cleared.', 'error');
            });
        }
    });
}

 

Thanks,

Danish

Tanushree Maiti
Giga Sage

Hi @Sathwik1 ,

 

If you are applying the onChange() client script on a reference variable ,in that case , can you try the same in other browser except chrome once .

 

Reason being "KB0715672 " says

 

"The 'confirm' doesn't work in onChange Client Script/Catalog Client Script created on a Reference filed/variable on Chrome Browser" .

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

It's not a reference field ..it's an attachment variable.