2 Replies Latest reply on Apr 6, 2015 11:31 AM by mushoku

    Show, mandate field not working in Web desk

    mushoku Apprentice

      I have a window calc to show and mandate a field if the Category is set to 'Other' on an incident:

      import System
      static def GetAttributeValue(Incident):
          HideOtherCat = true
          MandateOtherCat = false
          if Incident.Category != null and Incident.Category.Title == 'Other':
              HideOtherCat = false
              MandateOtherCat = true
          return String.Format(":SetHidden(_OtherCategory,{0});:SetMandatory(_OtherCategory,{1});",HideOtherCat,MandateOtherCat)
      

       

      At present, when I launch a new incident, the field is hidden and not mandatory.  When I select the Category as Other, nothing changes until after I save the incident, at which point the field shows and is mandatory.  This, essentially, allows techs to enter a category as other regardless of what the category actually is, and makes it the next tech's job to fill in the details of Other; the intent is to require our techs to enter details when they select Other, which should get them to just select the correct category the first time.

       

      Am I missing something to make it work? Or is it working as expected?

       

      I tried setting the calculation type to both Window Calculation and Before Save.

        • 1. Re: Show, mandate field not working in Web desk
          Mroche SupportEmployee

          The calculation type will need to be set to 'Window Calculation'.

           

          You will need to make sure you added 'Category' to the dependency pane on the calculation window and you need to modify the Incident window and set the 'Is Calculate on Change' property on the category attribute to True.  This tells the calculation to run when the value in the Category dropdown is selected.

           

          The attribute with the calculation on it must be on the window (it can be hidden by setting the show on window property of the attribute to false) and the calculation must not be on the source or target attributes.  Dynamic window calculations should be created on a separate String -1 field used to store that calculation only.

          • 2. Re: Show, mandate field not working in Web desk
            mushoku Apprentice

            Mroche wrote:

             

            ...set the 'Is Calculate on Change' property on the category attribute to True.  This tells the calculation to run when the value in the Category dropdown is selected.

             

            That was it.  Thank you so much for your help!