Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

need help in cilent script

nameisnani
Mega Sage

Hi Team 

 

can any one please help me , in this request 

for the particular catalog item , Based on the type of request ,  Infrasturure request should populate .

 

can any one please provide me script for this .

 

 

 

nameisnani_0-1721622239566.png

 

 

nameisnani_1-1721622239353.png

 

 

5 REPLIES 5

Pratiksha2
Mega Sage

Hello @nameisnani ,

Please create OnChange Client script and try below code:

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var infrastructureRequest = 'infrastructure_request'; // Replace with the actual variable name for Infrastructure Request

    // Clear current options
    g_form.clearOptions(infrastructureRequest);

    // Add options based on the selected type of request
    if (newValue === 'Kyndryl Mainframe') {
	g_form.clearOptions('infrastructure_request');
        g_form.addOption(infrastructureRequest, 'request_for_information', 'Request for Information');
        g_form.addOption(infrastructureRequest, 'audit_enquiries', 'Audit Enquiries');
        g_form.addOption(infrastructureRequest, 'data_extract', 'Data Extract');
        g_form.addOption(infrastructureRequest, 'infrastructure_design_enquiries', 'Infrastructure Design Enquiries');
        g_form.addOption(infrastructureRequest, 'shared_folder_access', 'Shared Folder Access');
        g_form.addOption(infrastructureRequest, 'storage_backup', 'Storage & Backup');
    } else if (newValue === 'AWS') {
	g_form.clearOptions('infrastructure_request');
        g_form.addOption(infrastructureRequest, 'request_for_information', 'Request for Information');
        g_form.addOption(infrastructureRequest, 'audit_enquiries', 'Audit Enquiries');
        g_form.addOption(infrastructureRequest, 'data_extract', 'Data Extract');
        g_form.addOption(infrastructureRequest, 'infrastructure_design_enquiries', 'Infrastructure Design Enquiries');
        g_form.addOption(infrastructureRequest, 'shared_folder_access', 'Shared Folder Access');
        g_form.addOption(infrastructureRequest, 'storage_backup', 'Storage & Backup');
    } else {
        // Add default options or handle other cases if necessary
    }
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Pratiksha