CA Service Management

 View Only
  • 1.  Filter dtlDropdown with SREL attribute

    Posted Mar 14, 2016 10:54 AM

    Hello everyone,

     

    I want to link a CI (family nr) to a CI (family slax).

    My family nr has an attribute (SREL) "z_it_service" that is a SREL to the nr table obviously.

     

    In my case a specific role needs to use that SREL but doesnt want to search for the required value in a Lookup field of houndreds of entries but wants to have a dropdown list with only his required three entries.

    So I tried to create a dropdown that shows only three values but still creates a correct SREL. Addtitionally that dropdown needs to filter the entries to only three left entries. Also we dont want to display the actual common name of the nr object but the content of an attribute that is located in the slax family named z_productname.

     

    So kind of "graphically":

     

    NR

    Dropdown     ->     NR

                                      -> SLAX

                                            -> z_productname

     

    So what I tried is to use the normal Dropdown function and add the list_display function like that, but I dont get it done.

     

    <PDM_MACRO name=dtlDropdown hdr="Test"

    attr="z_IT_service"

    make_required="yes"

    link="yes"

    factory="slax"

    list_display="z_productname"

    list_orderby="z_productname"

    rel_attr_name="id"

    use_list_display="1"

    whereclause="name='SERV-IT-000001' or name='SERV-IT-000002'">

     

    Could you please help me?



  • 2.  Re: Filter dtlDropdown with SREL attribute

    Posted Mar 14, 2016 12:16 PM

    Hi,

    First of all why to not use relationship to store this relation vs. custom attributes?

    I may mistaking it butthis is the all purpose of the CMDB

    What is your requirements around that?

    Just my thoughts

    /J



  • 3.  Re: Filter dtlDropdown with SREL attribute

    Posted Mar 15, 2016 03:29 AM

    Hello jmayer,

     

    the customer wants to have an easy dropdownbox with three values to decide in between. Especially he needs these names of the slax table to identify the correct CI.

    If we would use the relationships the time to maintain it would increase extremely and the issue with identifying the CI directly by the slax attribute is not solved.

     

    We thought about it a long time and think that our described way matches for us the best.

    So it would be nice if someone could help me.

     

    Thanks

    /P



  • 4.  Re: Filter dtlDropdown with SREL attribute

    Posted Mar 15, 2016 06:02 AM

    Ok so few things

     

    Did your custom attributes have been added to the slax metadata(cmdb_metadata_slax.htmpl)?

    To address your custom attribute you need to go the extended table using dotted notation. For the slax table will be assoc_slax.z_productname

    You can't use parameter in you macro that don't exist so the list_display="z_productname", list_orderby="z_productname",rel_attr_name="id",use_list_display="1" can't be used there

     

    Not in front  of a dev machine to test but the below will normally do it assuming you are also filtering on your z_productname(otherwise if you filter on CI name your previous whereclause must be ok already):

    <PDM_MACRO name=dtlDropdown hdr="Test" attr=z_IT_service.assoc_slax.z_productname  factory=slax lookup=no make_required=yes link=yes whereclause="assoc_slax.z_productname='SERV-IT-000001' or assoc_slax.z_productname='SERV-IT-000001'">

     

     

    Another think to optimize(but need an extra field) will be to create an integer flag on the nr object where you can flag the ci that need to be display or not this way you will only need to have a simple where clause likeand you don't need any other relation and attributes in th extended table:

     

    <PDM_MACRO name=dtlDropdown hdr="Test" attr=z_IT_service.assoc_slax.z_productname  lookup=no make_required=yes link=yes whereclause="z_display_flag=">

     

    Another way again to do this may the above not work will be to construct your own list with PDM_LIST and use js to construct your dropdown. giving you more control on the what you want to display from foreign table. (will be for another post if still needed )

     

    Hope this help.

    /J



  • 5.  Re: Filter dtlDropdown with SREL attribute

     
    Posted Mar 21, 2016 05:05 PM

    Hi - Did jmayer 's response help answer your question? If so please mark as Correct Answer. Thanks! Chris