Get the values from RITM and set the values to sc task to control the sc_task form field values

Naga13
Tera Contributor

Hi All,

I want to Get the values from RITM and set the values to sc task to control the sc_task form field values,

Below code is not working for me.

Note: Variable type is choice for both RITM and SC_task variables

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

    var storevalue = g_form.getValue('request_type');
    var ma = g_form.getOption('request_type', storevalue).text;
    g_form.setValue('request_type_task', ma);
    alert(ma);

    var storevalue1 = g_form.getValue('v_application_type');
    var ma1 = g_form.getOption('v_application_type', storevalue1).text;
    g_form.setValue('request_type_task', ma1);
    alert(ma1);

    //    var ma1 = g_form.getValue('v_application_type');
    // g_form.setValue('application_type_task', ma1);
}
Thanks in Advance
Venkata.
2 REPLIES 2

Deepak Shaerma
Kilo Sage

Hi @Naga13 ,

based on the given sceneio try to run this script, it will works for you:

function onLoad() {
    // Get the selected value for 'request_type'
    var requestTypeValue = g_form.getValue('request_type');
    g_form.setValue('request_type_task', requestTypeValue);
    alert("Request Type: " + requestTypeValue);

    // Get the selected value for 'v_application_type'
    var appTypeValue = g_form.getValue('v_application_type');
    g_form.setValue('application_type_task', appTypeValue);
    alert("Application Type: " + appTypeValue);
}

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma 

 



Ankur Bawiskar
Tera Patron
Tera Patron

@Naga13 

sorry without screenshot can't help much.

onLoad is on table or catalog client script? share config screenshots

you are playing with fields or variables in your above script?

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