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

Bhavya11
Kilo Patron

Priyanka0402
Mega Sage
Mega Sage

Hello

Try the below code make sure you are using correct backend values 

 

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.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.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
        g_form.addOption(infrastructureRequest, 'default_option', 'Default Option');
    }
}

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

Regards

Priyanka

Amit Verma
Kilo Patron
Kilo Patron

Hi @nameisnani 

 

Please follow below steps :

 

1. Configure your variable Infrastructure request with all the drop-down choices as shown below :

AmitVerma_0-1721625411226.png

 

AmitVerma_3-1721626426329.png

 

 

2. Create an On-Change Catalog Client Script on Type of Request variable :

 

AmitVerma_2-1721625577900.png

 

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

    //Type appropriate comment here, and begin script below

    var type = g_form.getValue('type_of_request');
    if (type == 'kyndryl') //use the backend value of the Knydrnl Mainframe
    {
        g_form.removeOption('infrastructure_request', 'shared_folder_access');
        g_form.removeOption('infrastructure_request', 'storage_and_backup');
        g_form.removeOption('infrastructure_request', 'patch_management');
    } else if (type == 'aws') {
        g_form.addOption('infrastructure_request', 'shared_folder_access', 'Shared Folder Access');
        g_form.addOption('infrastructure_request', 'storage_and_backup', 'Storage & Backup');
        g_form.addOption('infrastructure_request', 'patch_management', 'Patch Management');

    }

}

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Priya Biradar
Tera Contributor

Hi @nameisnani 

 

Please Use this Catalog Client script

PriyaBiradar_0-1721629436332.pngPriyaBiradar_1-1721629484393.png

PriyaBiradar_2-1721629532416.png

 

Thanks,

Priya Biradar