CA Service Management

 View Only
  • 1.  Custom Field Not Seen Initially (until saved)

    Posted Oct 05, 2018 10:06 AM

    With a lot of help (thank you cdtj), we created a custom required field for only specific categories and for only select roles CR Fields Only for Select Roles  . 


    Here is what we are seeing (also in attachments):


       1. The field doesn't show at all for any Roles when the new detail_in.htmpl form is loaded

       2. The field will then show up after the first save (for everyone to see)

       3. After this, any editing allow the Role restrictions to kick in and ensure required by the selected roles.


    I need this form to be visible on creation of a new incident while preserving step 2 and 3 where it works perfectly!


    I think the initial argument where I describe the affected category is restricting the view initially until the category is selected AND saved (which then allows the field to be seen). If so, how would I fix this?



    <PDM_IF "$args.category.sym" == "Hardware.Workstation.Laptop.Install">
    <PDM_IF $SESSION.ROLE_ID == "400151">
    <PDM_MACRO name=dtlTextbox hdr="Machine Name" attr="zz_PCNAME" make_required=yes>
    <PDM_MACRO name=dtlReadonly hdr="Machine Name" attr="zz_PCNAME">

  • 2.  Re: Custom Field Not Seen Initially (until saved)

    Posted Oct 08, 2018 03:58 PM

    Please understand that code like <PDM_IF ...> and <PDM_MACRO ...> are pre-processor commands resolved at the web server before the page is passed to your browser. To accomplish what you are trying to do will require some Javascript code that you will trigger by an onBlur event on the category field. The Javascript would have to hide/show the zz_PCNAME field.

  • 3.  Re: Custom Field Not Seen Initially (until saved)

    Posted Oct 11, 2018 02:59 PM

    Thank you very much Lindsay_Estabrooks  I went through and see a few onBlur references in the source code that appear to point back to the .env configuration. With the code example below:

    <PDM_MACRO name=dtlLookup hdr="Assignee" attr=assignee evt="onBlur=\\\"detailSyncEditForms(this)\\\"" make_required=yes>
    <PDM_MACRO name=dtlLookup hdr="Assignee" attr=assignee evt="onBlur=\\\"detailSyncEditForms(this)\\\"">


    can I just add the PDM_MACRO codes above in the source card preceding the making it required for my custom field or is there other places I need to update it?

  • 4.  Re: Custom Field Not Seen Initially (until saved)
    Best Answer

    Posted Oct 12, 2018 03:51 PM

    Hi Jessie,


    First, let me make sure I understand your requirement

    • If a person using a particular Role (400151) selects the category 'Hardware.Workstation.Laptop.Install', you want the field zz_PCNAME to appear and the person will be required to enter some text.
    • If a person who is not using the particular Role (400151) selects the category 'Hardware.Workstation.Laptop.Install', you DON'T want the field zz_PCNAME to appear and no entry is required.
    • For all other categories you don't want the field zz_PCNAME to appear.


    To handle this you are going to need to write a JavaScript function to look at the value of the category and show/hide the zz_PCNAME field. Kind of like this:


    function Show_PCname() {

      var x = document.getElementsByName("zz_PCNAME")[0];
      if(document.main_form.elements["KEY.category].value == 'Hardware.Workstation.Laptop.Install') { = "visible";

      } else { = "hidden";




    This is just a start and by no means complete or tested. You are also going to need to write a preSaveTrigger() function to handle the Required/NOT Required logic.


    As you can see this is not a simple thing especially if you are not used to JavaScript and the DOM. It leads me to ask why you are not using Properties in this case?




  • 5.  Re: Custom Field Not Seen Initially (until saved)

    Broadcom Employee
    Posted Oct 11, 2018 01:58 PM


    Did Lindsay_Estabrooks' recommendation help?