CA Service Management

Expand all | Collapse all

Assistance with dtlDropdown Documentation

  • 1.  Assistance with dtlDropdown Documentation

    Posted 05-14-2018 08:20 AM

    I'm trying to build a dropdown using dtlDropdown.  I've read the documentation for dtlDropdown here: https://docops.ca.com/ca-service-management/14-1/en/building/building-ca-service-desk-manager/using-the-web-screen-painter-wsp/pdm-macro-definitions#PDMMacroDefinitions-dtlDropdown

    This gives the list of parameters for dtlDropdown but does not give the order of the parameters.  I've pulled several examples for how these are built in the out of the box system, and have managed to figure out the position of some of the parameters, but not all of them.  This is an example from detail_macro.htmpl:

    detailDropdown("Object Type","ob_type","macro_prod_list",1,20,
      "1","","$args.ob_type","yes","name","","","","no","0","","",
                    "Configuration Item","nr",
                    "Contact","cnt",
      "Change Order","chg",
                    "Issue","iss",
                    "Issue Workflow Task","iss_wf",
      "Request/Incident/Problem","cr",
      "Request/Incident/Problem Workflow Task","cr_wf",
                    "Change Order Workflow Task","wf");

     

    I think I have figured out these parameters  detailDropdown("hdr", "attributeName", "factory", "colspan", "size"

             "required", "?", "?","?","?","?","?","?","?","?","?","whereclause",
                    "list_display","rel_attr_name""); 

     

    Does anyone have documentation that details which position holds which parameter or can fill in the blanks where the question marks are and can confirm those that I've filled in?

     

    Thanks!



  • 2.  Re: Assistance with dtlDropdown Documentation

    Broadcom Employee
    Posted 05-14-2018 11:26 AM

    Andrea, I think the order of parameters does not matter. That is, "colspan=x size=y" will not be different from "size=y colsoan=x". The parameters and their simple description are here:

    /////////////////////////////////////////////////////////

    description, name

    ------------------------------------------------------------------------------------

    "The name of the attribute" ,"attr"
    "Allow autofill if field becomes a lookup" ,"autofill"
    "Width of the dropdown box in px" ,"cbwidth"
    "Name of the code for dropdown values in the ui_selection object" ,"codename"
    "The number of columns on the form" ,"colspan"
    "Default value when attribute null" ,"default"
    "Event handler string" ,"evt"
    "For passing extra URL information. Not for general use." ,"extraURL"
    "Defaults to $args.FACTORY_&attr" ,"factory"
    "The text of the header." ,"hdr"
    "If attr=\"n/a\" ,provide id for KT forms" ,"id"
    "Initial value (overrides database)" ,"initial"
    "Specify yes to put a link to detail on the readonly" ,"link"
    "Replacement for list.COMMON_NAME" ,"list_display"
    "Orders the list." ,"list_orderby"
    "Convert this dropdown to a lookup if the number of entries would exceed the value of SelListCacheMax" ,"lookup"
    "Not for general use. Makes a field REQUIRED on the form regardless of whether it is REQUIRED in the object/database layer." ,"make_reqed"
    "If specified, the macro may also use use_list_display, list_display and list_orderby.\\0012rel_attr_name and codename are mutually excle. whereclause is required." ,"rel_attr_name"
    "Input box width if dropdown changes to a lookup" ,"size"
    "title for screen reader users" ,"title"
    "Set to 1 if macro contains list_display. As list_display may contain one or more dollar signs, use_list_display is used by pdm_if states " ,"use_list_display"
    "Where Clause" ,"whereclause"

    //////////////////////////////////////////////////////////////////////////////////////////////////////////

    Thanks

    Chi



  • 3.  Re: Assistance with dtlDropdown Documentation

    Posted 05-14-2018 11:33 AM

    How can the order not matter when none of the parameter names are given in the code?  As given in the example above from detail_macro.htmpl:

    detailDropdown("Object Type","ob_type","macro_prod_list",1,20,
      "1","","$args.ob_type","yes","name","","","","no","0","","",
                    "Configuration Item","nr",
                    "Contact","cnt",
      "Change Order","chg",
                    "Issue","iss",
                    "Issue Workflow Task","iss_wf",
      "Request/Incident/Problem","cr",
      "Request/Incident/Problem Workflow Task","cr_wf",
                    "Change Order Workflow Task","wf");

     

    No parameter names are used.  Since no parameter names are used, the order has to matter or how can SDM interpret the information given to detailDropdown?



  • 4.  Re: Assistance with dtlDropdown Documentation

    Broadcom Employee
    Posted 05-14-2018 11:49 AM

    Andrea, dtlDropdown implementation is

    {\\0012<PDM_IF \"&{title}\" != \"\">\\0012detailSetFieldTitle(\"&{title}\");\\0012</PDM_IF>\\0012<PDM_IF \"&{evt}\" != \"\">\\0012detailSetEventHandler(\"&{evt}\");\\0012</PDM_IF>\\0012detailDropdown(\"&{hdr}\",\\0012<PDM_IF \"&{attr}\" == \"n/a\">\\0012   <PDM_IF \"&{id}\" != \"\">\\0012     \"&{id}\"\\0012   <PDM_ELSE>\\0012   \"\"\\0012   </PDM_IF>\\0012<PDM_ELSE>\\0012\"&{attr}\"\\0012</PDM_IF>, \\0012<PDM_IF \"&{factory}\" != \"?\">\\0012\"&{factory}\",&{colspan},&{size}, \\0012<PDM_ELSE>\\0012\"$args.FACTORY_&{attr}\",&{colspan},&{size}, \\0012</PDM_IF>\\0012<PDM_IF \"&{make_required}\" == \"yes\">\\0012   <PDM_IF \"&{attr}\" == \"n/a\">\\0012      \"1\"\\0012   <PDM_ELSE>\\0012      \"1:$args.LOCKED_&{attr}\"\\0012   </PDM_IF>,\\0012<PDM_ELSE>\\0012   <PDM_IF \"&{attr}\" == \"n/a\">\\0012      \"0\"\\0012   <PDM_ELSE>\\0012      \"$args.REQUIRED_&{attr}:$args.LOCKED_&{attr}\"\\0012   </PDM_IF>,\\0012</PDM_IF>\\0012<PDM_IF \"&{attr}\" == \"n/a\">\\0012   \"\"\\0012<PDM_ELSE>\\0012   \"$args.&{attr}.persistent_id\"\\0012</PDM_IF>,\\0012<PDM_IF \"&{initial}\" == \"n/a\">\\0012   <PDM_IF \"&{attr}\" == \"n/a\">\\0012      \"\"\\0012   <PDM_ELSE>\\0012      <PDM_FMT PAD=NO ESC_STYLE=JS2>\"$args.&{attr}\"</PDM_FMT>\\0012   </PDM_IF>,\\0012<PDM_ELSE>\\0012<PDM_FMT PAD=NO ESC_STYLE=JS2>\"&{initial}\"</PDM_FMT>, /* $args.&{attr} */\\0012</PDM_IF>\\0012<PDM_IF \"&{attr}\" == \"n/a\" || \"&{rel_attr_name}\" != \"\" || \"&{codename}\" != \"\">\\0012   \"no\"\\0012<PDM_ELSE>\\0012   \"&{autofill}:$args.&{attr}.TENANCY:$args.&{attr}.SERVICE_PROVIDER_ELIGIBLE\"\\0012</PDM_IF>,\\0012<PDM_IF \"&{rel_attr_name}\" != \"\">\\0012\"\",\"\",\\0012<PDM_ELSE>\\0012\"$args.&{attr}.COMMON_NAME_ATTR\",\\0012<PDM_FMT PAD=NO ESC_STYLE=JS2>\"$args.&{attr}.COMMON_NAME\"</PDM_FMT>,\\0012</PDM_IF>\\0012<PDM_IF \"$FRONTPAGE\" != \"1\">\\0012\"${args.SEARCH_STATUS_&{attr}:}\",\\0012<PDM_ELSE>\\0012\"\",\\0012</PDM_IF>\\0012\"${args.SEARCH_RESULTS_&{attr}:}\",\\0012<PDM_IF \"&{codename}\" != \"\">\\0012\"no\",\\0012<PDM_ELSE>\\0012\"&{link}\",\\0012</PDM_IF>\\0012\"&{cbwidth}\",\"&{extraURL}\",\\0012<PDM_IF \"&{codename}\" != \"\">\\0012  \"&{default}\"\\0012  <PDM_LIST prefix=list FACTORY=\"ui_selection_values\" WHERE=\"delete_flag=0 AND code='&{codename}'\">\\0012    ,\"$list.text\",\"$list.value\"</PDM_LIST>);\\0012<PDM_ELIF \"&{rel_attr_name}\" != \"\">\\0012   \"&{default}\" \\0012      <PDM_IF \"&{use_list_display}\" == \"1\" && \"&{list_orderby}\" != \"\">\\0012         <PDM_LIST PREFIX=list WHERE=\"&{whereclause}\" FACTORY=\"&{factory}\" ORDER_BY=\"&{list_orderby}\">\\0012         <PDM_FMT PAD=NO ESC_STYLE=C>,\"&{list_display}\",\"$list.&{rel_attr_name}\"</PDM_FMT></PDM_LIST>); \\0012      <PDM_ELIF \"&{use_list_display}\" == \"1\">\\0012         <PDM_LIST PREFIX=list WHERE=\"&{whereclause}\" FACTORY=\"&{factory}\">\\0012         <PDM_FMT PAD=NO ESC_STYLE=C>,\"&{list_display}\",\"$list.&{rel_attr_name}\"</PDM_FMT></PDM_LIST>); \\0012      <PDM_ELSE>\\0012         <PDM_LIST PREFIX=list WHERE=\"&{whereclause}\" FACTORY=\"&{factory}\">\\0012         <PDM_FMT PAD=NO ESC_STYLE=C>,\"$list.COMMON_NAME\",\"$list.&{rel_attr_name}\"</PDM_FMT></PDM_LIST>); \\0012      </PDM_IF>\\0012<PDM_ELIF \"&{factory}\" != \"?\">\\0012  <PDM_IF \"&{lookup}\" == \"no\" || \"$args.&{attr}.UI_INFO\" : \"-LOOKUP\" || \"&{factory}\" : \"prod_list\" || \"&{whereclause}\" != \"\">\\0012    <PDM_IF \"&{whereclause}\" != \"\">\\0012      \"&{default}\"\\0012      <PDM_LIST PREFIX=list WHERE=\"&{whereclause}\" FACTORY=&{factory} LOOKUP=&{attr} ESC_STYLE=JS2>\\0012      ,\"$list.COMMON_NAME\",\"$list.REL_ATTR\"</PDM_LIST>);\\0012    <PDM_ELSE>\\0012      \"&{default}\"\\0012      <PDM_LIST PREFIX=list WHERE=\" \" FACTORY=&{factory} LOOKUP=&{attr} ESC_STYLE=JS2>\\0012      ,\"$list.COMMON_NAME\",\"$list.REL_ATTR\"</PDM_LIST>);\\0012    </PDM_IF>\\0012  <PDM_ELSE>\\0012    \"&{default}\",\\0012    <PDM_FMT PAD=NO ESC_STYLE=JS2>\"$args.&{factory}_SELECTIONS\"</PDM_FMT>);\\0012  </PDM_IF>\\0012<PDM_ELSE>\\0012  <PDM_IF \"&{lookup}\" == \"no\" || \"$args.&{attr}.UI_INFO\" : \"-LOOKUP\" || \"&{whereclause}\" != \"\">\\0012    <PDM_IF \"&{whereclause}\" != \"\">\\0012    \"&{default}\"\\0012      <PDM_LIST PREFIX=list WHERE=\"&{whereclause}\" FACTORY=$args.FACTORY_&{attr} LOOKUP=&{attr} ESC_STYLE=JS2>\\0012      ,\"$list.COMMON_NAME\",\"$list.REL_ATTR\"</PDM_LIST>);\\0012    <PDM_ELSE>\\0012      \"&{default}\"\\0012      <PDM_LIST PREFIX=list WHERE=\" \" FACTORY=$args.FACTORY_&{attr} LOOKUP=&{attr} ESC_STYLE=JS2>\\0012      ,\"$list.COMMON_NAME\",\"$list.REL_ATTR\"</PDM_LIST>);\\0012    </PDM_IF>\\0012  <PDM_ELSE>\\0012    \"&{default}\",\\0012    <PDM_FMT PAD=NO ESC_STYLE=JS2>\"$args.&{attr}.SELECTIONS\"</PDM_FMT>);\\0012  </PDM_IF>\\0012</PDM_IF>\\0012<PDM_IF \"$args.&{attr}.TENANCY\" == \"1\" || \"$args.&{attr}.TENANCY\" == \"2\">\\0012<PDM_IF \"$args.&{attr}.tenant\" != \"\" && \"$args.&{attr}.tenant\" != \"00\" && \"$args.&{attr}.TENANCY_UNRESTRICTED\" == \"0\">\\0012detailAddTenantImplyingAttr(\"&{attr}\",\"$args.&{attr}.tenant\",\"$args.&{attr}.tenant.name\",$args.&{attr}.TENANCY,\"$args.&{attr}.SERVICE_PROVIDER_ELIGIBLE\");\\0012</PDM_IF>\\0012</PDM_IF>\\0012}\\0012"

    It is not easy to read this and the reason I drop it here is to help understand why the order does not matter.

    Thanks

    Chi



  • 5.  Re: Assistance with dtlDropdown Documentation

    Broadcom Employee
    Posted 05-14-2018 11:57 AM

    Andrea, the dtlDropdown() implementation is different. I tried to paste the whole script here but ended up had it "Currently being moderated."...the implementation script has &{hdr} , &{colspan} etc and I think that is the reason why the order does not matter. Thanks _Chi



  • 6.  Re: Assistance with dtlDropdown Documentation

    Posted 05-14-2018 12:06 PM

    Sorry, my bad, dtlDropdown and detailDropdown are different.  detailDropdown is actually what I'm looking for.  Is there any documentation on detailDropdown?

     

    Thanks.



  • 7.  Re: Assistance with dtlDropdown Documentation

    Broadcom Employee
    Posted 05-14-2018 02:45 PM

    dtlDropdown() is the one recommended for customization therefore I don't think there is some documentation for detailDropdown(). However, the function defined in detail_form.js file has

    function detailDropdown(hdrtext, attr_name, obj_type, colspan, size,
    is_required, persid, rel_attr,
    autofill, common_name_attr, common_name_value,
    search_status, search_results, link, cbwidth, extraURL,
    dflt, selections )

    Many of them are self-explained and more details can be found by reading the script of this function in the same file.

    And by the way, this gives the order if the arguments.:)

    My 2cents. Thanks _Chi