UI Policy / Client Script on Catalog Item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 07:45 AM - edited 08-04-2023 07:51 AM
Hello All,
There is a catalog item with 48 Variable set and multiple variables within. And there should be dependencies based on the selection of each variables.
There were few UI policies in place yet it did not work as expected as there were around 47 catalog client scripts.
For example :
Select Box 1 > If this is selected there will be a dropdown with 6 options
When any one is selected from above then another select box(6 different variables has to appear)
Select box 2 > If this is selected then it should show few options
When Option 1 is selected it has to show some variables accordingly so I had to come up with creating a client script as below
I have created client script onchange of each different variables to achieve the same . I hide and show the variables accordingly depending different variables using the same script below and change them on allArr and inputArr
enabledropdown(newValue);
function enabledropdown(Sb1){
var allArr = ["edi_test_othes_description","edi_test_employee_role_change_transfer_label","edi_test_replacement_device_rma_label","edi_test_for_test_for_user_request_type_user_access_renewal_label","edi_test_for_test_remove_test_access_for_existing_user","edi_new_test_user_label","edi_test_logging_and_audit_report_attach_button","edi_test_updates_to_existing_vpn_label","edi_test_for_test_user_request_label","edi_test_employee_role_change_transfer_manager_acknowledgement_checkbox1","edi_test_for_test_new_code1_laptop_request_label","edi_add_test_access_for_existing_user_label","edi_test_new_vpn_projects_label","edi_test_updates_to_existing_vpn_label2_start","edi_test_for_test_for_user_request_type_user_access_renewal_label2_start","edi_new_test_user_manager_acknowledgement_label_start","edi_add_test_access_for_existing_user_start","edi_test_for_test_for_user_request_type_user_access_renewal_manager_ack","edi_add_test_add_test_access_for_existing_user_acknowledgement","edi_test_for_test_remove_test_email_id","edi_test_replacement_device_rma_description","edi_test_logging_and_audit_report_start_date","edi_test_new_vpn_projects_description","edi_new_test_user_manager_acknowledgement","edi_test_updates_to_existing_vpn_manager_ack","edi_test_for_test_new_code1_laptop_request_user_acknowledgement","edi_test_employee_role_change_transfer_manager_acknowledgement","edi_test_updates_to_existing_vpn_manager_ack_spl_access","edi_test_for_test_for_user_request_type_user_access_renewal_manager_ack_spl_access","edi_new_test_user_manager_acknowledgement_confirmation","edi_add_test_add_test_access_for_existing_user_acknowledgement_confirmation","edi_test_logging_and_audit_report_end_date","edi_test_updates_to_existing_vpn_description","edi_test_logging_and_audit_report_customer_name"];
var inputArr = {
"test":["edi_add_or_remove_email","edi_special_instructions|1"],
"test":["edi_approving_manager","edi_site_id","edi_site_name","edi_hostname","edi_case_number","edi_stack_ids","note","edi_special_instructions|1"],
"test":["edi_site_id","edi_site_name","edi_hostname","edi_tsm_and_ip_address","edi_special_instructions|1"],
"test":["edi_tsm_client_installed"],
"test":["edi_case_number","edi_reason_for_restoration","edi_site_id","edi_site_name","edi_hostname","edi_how_many_suids","edi_special_instructions|1"],
"test":["edi_site_id","edi_site_name","edi_hostname","edi_consolidation_information","edi_special_instructions|1"],
"edi_other":["edi_special_instructions|1"]
};
allArr.some(function(field) {
g_form.setValue(field,'');
g_form.setMandatory(field, false);
g_form.setDisplay(field, false);
});
if(Sb1 !== '' && Sb1 !== undefined){
inputArr[Sb1].some(function(field) {
var fld = field.split('|');
var len = fld.length;
//alert(len);
g_form.setDisplay(fld[0], true);
if(len == 1){
g_form.setMandatory(fld[0], true);
}
});
}
}
This solved the problem on the front end. However, it is not showing up correctly on the Variable Editor.
The variables are not showing up as per the selection despite of choosing Apply on Catalog Tasks and UI type as both
Need help with suggestions
TIA
@Ankur Bawiskar @Mark Roethof @Ian Leu @Tony Chatfield1 @Bruno De Graeve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 09:49 AM
Maybe you can check is there any dependency with these choice fields. If yes then you can add an attribute “ref_qual_element”= dependent variable.So the choice field visible based on the selection of prior variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 10:53 AM
Can you please share any examples for reference