Need help in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 08:31 PM
Hi Team
can any one please help me , in this request
Based on the type of request , Infrasturure request should populate .
can any one please provide me script for this .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 09:38 AM
hi @nameisnani ,
please correct your code you need to give
g_form.removeOption('infrastruture',shared_floder')
g_form.removeOption('infrastruture',storage_backup')
g_form.removeOption('infrastruture',patch_management);
//like this you need to give one by one for each choice for removing and adding
g_form.addOption('infrastucture',"backend value', ' NAME OF THE CHOICE')//These these are for one choice

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 10:14 PM
Hello @nameisnani
Could you please try the below sample script for onchange catalog client script:
(function() {
// Define the mapping between "Type of Request" and "Infrastructure Request"
var typeToInfrastructureMapping = {
"Network": "Network Setup",
"Hardware": "Hardware Installation",
"Software": "Software Installation",
"Security": "Security Configuration"
};
// Get the value of the "Type of Request" field
g_form.getControl('type_of_request').onchange = function() {
var typeOfRequest = g_form.getValue('type_of_request');
// Check if the value exists in the mapping
if (typeToInfrastructureMapping[typeOfRequest]) {
// Set the "Infrastructure Request" field value based on the mapping
g_form.setValue('infrastructure_request', typeToInfrastructureMapping[typeOfRequest]);
} else {
// Clear the "Infrastructure Request" field if no match is found
g_form.setValue('infrastructure_request', '');
}
};
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 11:16 PM
Hi @nameisnani
Please use this client script