Grtting error on g_scratchpad using in onsubmit client script(catalog item)

Venky Kshatriy2
Tera Contributor

Hi team,

 

i am calling script include in on submit client script and i used the g_scratchpad method i am getting below error

 

onSubmit script error: ReferenceError: g_scratchpad is not defined:
function () { [native code] }

 

 

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

    if (g_scratchpad.validForm) {
        return;
    }


    var partner = g_form.getValue('select_partner');
    var segment = g_form.getValue('segment_lead');

    var mrvs = g_form.getValue('itinerary');

    var vk = new GlideAjax("Decision_table_risk_rating");
    vk.addParam('sysparm_name', 'getriskratings');
    vk.addParam('sysparm_from', g_form.getValue('from_originating_country'));
    vk.addParam('sysparam_to', g_form.getValue('to_destination_country'));
    vk.addParam('sysparam_mrvs', mrvs);

    vk.getXML(function risk(response) {

        var answer = response.responseXML.documentElement.getAttribute("answer");
        alert('risk_rating' + answer);
        g_form.setValue('risk_rating', answer);
        if (answer == 1 && partner == '' && segment == '') {
            g_form.setVisible('partner', true);
            g_form.setVisible('segment', true);
            g_form.setMandatory('partner', true);
            g_form.setMandatory('segment', true);
            g_scratchpad.validForm = false;
        } else {
            g_scratchpad.validForm = true;
            g_form.submit();
        }
    });
5 REPLIES 5

Thanks for your ans

 

Hi @Chaitanya Redd1 

 

Value is setting correct but its not allowing to submit any condition