On change Client script not showing some of the variable field selection

Community Alums
Not applicable

Hi, 

Some help with a onChange catalog client script, if I select the below criteria: 

query type does not populate, instead when you click on the drop down the whole variable list shows and its suppose to show "Other" 

OR 

Carol6_1-1696534726615.png

or when I select "Files" query type does not populate, instead when you click on the drop down the whole variable list shows

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
   if (newValue == '') {
alert('empty query type');
        g_form.clearOptions('query_type');
    }
 
    g_form.clearOptions('query_type');
    if (newValue === 'RSCA Campaign') {
        g_form.addOption('query_type', '', 'None');
        g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
        g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
        g_form.addOption('query_type', 'Delete', 'Delete');
        g_form.addOption('query_type', 'Other', 'Other');
 
    } else {
        if (newValue === 'Assessment Objects') {
            g_form.addOption('query_type', '', 'None');
            g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
            g_form.addOption('query_type', 'Update the RCSA Type', 'Update the RCSA Type');
            g_form.addOption('query_type', 'Delete', 'Delete');
            g_form.addOption('query_type', 'Other', 'Other');
 
 
    } else {
            if (newValue === 'Risks') {
            g_form.addOption('query_type', '', 'None');
                g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User field(Capturer/Approver/Owner/Co-ordinator, etc.)');
                g_form.addOption('query_type', 'Update the Fields', 'Update the Fields');
                g_form.addOption('query_type', 'Delete', 'Delete');
                g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
                if (newValue === 'Controls') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                    g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
                    g_form.addOption('query_type', 'Update the Fields', 'Update the Fields');
                    g_form.addOption('query_type', 'Delete', 'Delete');
                    g_form.addOption('query_type', 'Other', 'Other');
 
                } else {
                    if (newValue === 'Test Plans') {
                        g_form.addOption('query_type', '', 'None');
                        g_form.addOption('query_type', 'Amend Start Date/Frequency/Next Test Date', 'Amend Start Date/Frequency/Next Test Date');
                        g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                        g_form.addOption('query_type', 'Other', 'Other');
 
                 } else {
                    if (newValue === 'Test Results') {
                        g_form.addOption('query_type', '', 'None');
                        g_form.addOption('query_type', 'Amend Start Date/Frequency/Next Test Date', 'Amend Start Date/Frequency/Next Test Date');
                        g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                        g_form.addOption('query_type', 'Delete', 'Delete');
                        g_form.addOption('query_type', 'Other', 'Other');
 
                  } else {
                     if (newValue == 'Programs' ) {
                         g_form.addOption('query_type', 'Other', 'Other');
 
    } else{
                 if (newValue === 'Questionnaire Assessments') {
                     g_form.addOption('query_type', 'Other', 'Other');
 
   } else {
     if (newValue === 'Questionnaire Templates') {
 
   g_form.addOption('query_type', 'Other', 'Other');
 
                   } else {
                      if (newValue === 'Risk Events') {
                         g_form.addOption('query_type', '', 'None');
                         g_form.addOption('query_type', 'Cancel Risk Event', 'Cancel Risk Event');
   g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
  g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
                         g_form.addOption('query_type', 'Error on Risk Event', 'Error on Risk Event');
                         g_form.addOption('query_type', 'Unlock/Lock RE', 'Unlock/Lock RE');
                         g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                         g_form.addOption('query_type', 'Error on Non-Financial Impact Ratings', 'Error on Non-Financial Impact Ratings');
                         g_form.addOption('query_type', 'Delete', 'Delete');
                         g_form.addOption('query_type', 'Other', 'Other');
 
                     } else {
                        if (newValue === 'Event Recoveries') {
                            g_form.addOption('query_type', '', 'None');
                            g_form.addOption('query_type', 'Unlock/Lock Recovery', 'Unlock/Lock Recovery');
                            g_form.addOption('query_type', 'Move to Another Business Entity (Only for Multi Impacted)', 'Move to Another Business Entity (Only for Multi Impacted)');
                            g_form.addOption('query_type', 'Delete', 'Delete');
                            g_form.addOption('query_type', 'Other', 'Other');
 
 
                      } else {
                         if (newValue === 'Event Impacts') {
                             g_form.addOption('query_type', '', 'None');
                             g_form.addOption('query_type', 'Unlock/Lock Impact', 'Unlock/Lock Impact');
                             g_form.addOption('query_type', 'Move to Another Business Entity (Only for Multi Impacted)', 'Move to Another Business Entity (Only for Multi Impacted)');
                             g_form.addOption('query_type', 'Delete', 'Delete');
                             g_form.addOption('query_type', 'Error on Non-Financial Impact Ratings', 'Error on Non-Financial Impact Ratings');
                             g_form.addOption('query_type', 'Other', 'Other');
 
                      } else {
                          if (newValue === 'RCALL') {
                              g_form.addOption('query_type', '', 'None');
                              g_form.addOption('query_type', 'Unlock/Lock RCALL', 'Unlock/Lock RCALL');
                              g_form.addOption('query_type', 'Update the Status', 'Update the Status');
                              g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
                              g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
                              g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                              g_form.addOption('query_type', 'Delete', 'Delete');
                              g_form.addOption('query_type', 'Other', 'Other');
 
 
                       } else {
                          if (newValue === 'ORX') {
 
                             g_form.addOption('query_type', 'Other', 'Other');
 
                         } else {
                           if (newValue === 'Key Indicators') {
                             g_form.addOption('query_type', '', 'None');
                             g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
                             g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
                             g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                             g_form.addOption('query_type', 'Delete', 'Delete');
                             g_form.addOption('query_type', 'Other', 'Other');
 
 
             } else {
                     if (newValue === 'Key Indicator Values') {
                          g_form.addOption('query_type', '', 'None');
                          g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
                          g_form.addOption('query_type', 'Delete', 'Delete');
                          g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
                if (newValue === 'Issues') {
                       g_form.addOption('query_type', '', 'None');
                       g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                       g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
                       g_form.addOption('query_type', 'Change the Issue Type', 'Change the Issue Type');
                       g_form.addOption('query_type', 'Issue Due Date Extension Error', 'Issue Due Date Extension Error');
                       g_form.addOption('query_type', 'Delete', 'Delete');
                       g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
               if (newValue === 'Action Items') {
                     g_form.addOption('query_type', '', 'None');
                     g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
                     g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
     g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
                     g_form.addOption('query_type', 'Delete', 'Delete');
                     g_form.addOption('query_type', 'Other', 'Other');
 
           } else {
              if (newValue === 'Assurance') {
 
                  g_form.addOption('query_type', 'Other', 'Other');
 
           } else {
              if (newValue === 'PA') {
 
                  g_form.addOption('query_type', 'Other', 'Other');;
           } else {
              if (newValue === 'UOM') {
 
                 g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
               if (newValue === 'Business Entity') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
                    g_form.addOption('query_type', 'Update the User fields (Head of Ops Risk/CRO, etc.)', 'Update the User fields (Head of Ops Risk/CRO, etc.)');
                    g_form.addOption('query_type', 'Extract the Business Entity Structure', 'Extract the Business Entity Structure');
                    g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
                if (newValue === 'Legal Entities') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
            g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
               if (newValue === 'Preference') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
                    g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
    g_form.addOption('query_type', 'Update the Thresholds (RICM values)', 'Update the Thresholds (RICM values)');
                    g_form.addOption('query_type', 'Extract the Preferences with thresholds', 'Extract the Preferences with thresholds');
                    g_form.addOption('query_type', 'Other', 'Other');
 
 
            } else {
               if (newValue === ' Access') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Policy Violation', 'Policy Violation');
            g_form.addOption('query_type', 'Errors', 'Errors');
            g_form.addOption('query_type', 'Other', 'Other');
 
            } else {
               if (newValue === 'ORMS Access') {
                    g_form.addOption('query_type', '', 'None');
                    g_form.addOption('query_type', 'Prod', 'Prod');
                    g_form.addOption('query_type', 'PlayPen', 'PlayPen');
 
           } else {
               if (newValue === 'Cognos Access') {
                   g_form.addOption('query_type', '', 'None');
                   g_form.addOption('query_type', 'Prod', 'Prod');
           g_form.addOption('query_type', 'PlayPen', 'PlayPen');
  
 
            } else {
              if (newValue == 'Cognos') {
                g_form.addOption('query_type', '', 'None');
                 g_form.addOption('query_type', 'Build a new report', 'Build a new report');
g_form.addOption('query_type', 'Run/Query on Existing Report', 'Run/Query on Existing Report');
                                              
} else {
                      if (newValue == 'Files') {
                           g_form.addOption('query_type','Other', 'Other');
   g_form.SetValue('query_type', 'Other');
                                              }
}
                                                                                                            }
                                                                                                        }
                                                                                                    }
 
                                                                                                    //Type appropriate comment here, and begin script below
 
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
}
}
}
}
}
}

 

 

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

I am not sure why you have a '{' in else { if. It should have been else if. I would suggest to fix that first. You also have '===' in most of the conditions but not for the last two if statements.


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

Community Alums
Not applicable

Hi @SanjivMeher 

 

Doesn't work removed all '{' and used '==' for everything. still doesn't populate the 'query type" with the correct variables. 

 

Do you have any other onChange Client script running when query type value changes?

I dont see any other issue with the script


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