Script to show fields when multiple items selected

Script to show fields when multiple items selected

Good day,

Again I am in need of help from the script guru's here,

I need a Service Desk Plus cloud script that can show or hide fields depending if one or more items is selected in a multi select field.

AI gave me this:
  // Assume the multi-select field's name is 'category'
var selectedValues = CS.getValues("txt_product_description"); // Returns an array of selected options

if (selectedValues.length > 1) {
    // Unhide the target field
    CS.showFields("txt_dsv_code2", true);
} else {
    // Hide the target field
    CS.hideFields()"txt_dsv_code2", false);
}
CS.end();   

As usual I get an error when it is run:


Any help will be apreciated.

(I have came up with a way of doing it with out a script, but a script will save me a lot of time)

Regards

                  New to ADSelfService Plus?