CA Service Management

 View Only
  • 1.  CA Service Catalog cascading dropdowns

    Posted Mar 21, 2019 04:02 AM

    Hello all,

     

    did anyone managed to create cascading dropdowns on catalog form?

     

    For example:

     

    First drodown:

    Service 1

    Service 2

    Service 3

     

    Second dropdown depending of the first choice displaying values subservices

    If selected Service 1 then in the second dropdown values

    Service 1.Subservice 1

    Service 1.Subservice 2

    Service 1.Subservice 3

     

    If selected Service 2 then in the second dropdown values

    Service 2.Subservice 1

    Service 2.Subservice 2

    Service 2.Subservice 3

    And so on..

     

    Best Regards,

    Domagoj



  • 2.  Re: CA Service Catalog cascading dropdowns

    Posted Apr 04, 2019 03:48 AM

    Hello, 

     

    You can do this by using the data from the selected option in the First dropdown to filter the second dropdown.

     

    case 1: Using report data to give info to the select component.

    choose service2 in First dropdown, and trigger (on change) a reload with JavaScript function ca_fdFetchSelectData(ca_fd.formId, 'select2);

     

    select2 should have this in report variable: $({'filter':ca_fdGetSelectedOptionValues(ca_fd.formId, 'select1')[0]})

    , the chosen value in select1 is used when loading the options in select2.

     

     

     

    case 2: Using static option components in a select.

    The easiest thing to do here is to make a JavaScript function to show and hide different select component based on what selected option.

     

    You would need select1, select2-1, select2-3, select2-3, and so on and logic that only shows one of the select2-# simultaneous.

     

     

    Kind regards Fredrik Rönning Netgain AB Sweden

    https://www.netgain.se



  • 3.  Re: CA Service Catalog cascading dropdowns

    Posted Apr 04, 2019 04:07 AM

    Thanks Fredrik for your response.

     

    With case 2 you mean something like this?

    $(document).ready(function(){        $("select").change(function(){            $( "select option:selected").each(function(){                if($(this).attr("value")=="red"){                    $(".red").show();                }                if($(this).attr("value")=="green"){                     $(".green").show();                }            });        }).change();    });

    It seems to me also that the second way should be easier.



  • 4.  Re: CA Service Catalog cascading dropdowns

    Posted Apr 04, 2019 03:58 PM

    No, you should use Catalog API functions and forget about jquery to control form items.

     

    You need two dropdown with dynamic data (report object)

     

    Your dependant report object should be configured to request a parameter.

     

    you can define an onChange function and set it on the first dropdown properties on the right pane.

     

    In this function, you can trigger a data refresh in your dependant dropdown by calling ca_fdFetchSelectData() on it.

     

    Your dependant dropdown should have a report variable set in its properties the exact same way FredrikRonning showed you.

     

     

    Catalog's documentation is pretty complete : https://docops.ca.com/ca-service-management/17-1/en/using/service-catalog-management/manage-forms