6 Replies Latest reply on Jan 11, 2016 10:35 AM by jasoncadman

    multi select list box display for dynamic window rule

    jasoncadman Expert

      Dear All

       

      I'm working on a project that uses a multi select box but I'm having a couple of problems with it. Here's one:

       

      On my update window i only want to show the multi select list box if it has items selected in it on that incident. If nothing has been selected then it should not show. I can't find a collection attached to the incident that shows this information. The collection object is there but shows all the items in the reference list that is shown in the multi select box..... Hold on, the linking object should have this information in it should it? I'll try a calc that queries that information

       

      I think that i may be on the way to answering my own question

       

      Thanks

       

      Jason

        • 1. Re: multi select list box display for dynamic window rule
          Fabian Schmidt Expert

          As far as I know it is not possible to hide a multi select list box using window calculations.

          At least I was NOT able to get it working.

          • 2. Re: multi select list box display for dynamic window rule
            jasoncadman Expert

            I've got the show\hide working in a basic format. (Checking if a parent incident exists and showing the multi select list box if it does). You just  show\hide the collection attribute that the multi select box is based on

             

            The bit that I'm struggling with is showing the multi select box when it's populated This is probably a bit involved but here's what i have so far:

             

            If there's a parent incident and it has a particular category title then:

                 set the parent guid as variable,

                 bring back that guid as a real incident using getobjectbyattribute. and store that as another variable.

                 Use that guid result to search the Object Link table that was created for the multi select box and

                      if there's a result match then return the variables set in the form of a dynamic window instruction

             

            import System

            static def GetAttributeValue(Incident):

              S1Hide = true

              S1Man = false

              S1RO = true

              MainHide = false

              MainMan = false

              Parent = null

              ParentGuid = null

              LinkIDtoSearch = null

              LinkIDResults = null

             

              for ParentLink in Incident.Parents: 

              Parent = ParentLink.Parent

             

             

              if Parent != null:

              if Parent.Category.Title == "Permission Edit":

              ParentGuid = Parent.Guid

              LinkIDtoSearch = Incident.GetObjectByAttribute("IncidentManagement.Incident", "Guid", ParentGuid)

              LinkIDResults = Incident.GetObjectByAttribute("IncidentManagement._IncidentSystmOneUnitLink", "_Incident", LinkIDtoSearch)

              if LinkIDResults != null:

              S1Hide = false

              S1Man = false

              S1RO = true

              MainHide = true

              MainMan = false

              instructions  = ":SetReadOnly(_SystmOneUnitsCol, ${S1RO});:SetHidden(_SystmOneUnitsCol, ${S1Hide});:SetMandatory(_SystmOneUnitsCol, ${S1Man});:SetHidden(_PhoneNumber, ${MainHide});:SetHidden(CreationUser, ${MainHide});:SetHidden(_IncidentFloorLoc, ${MainHide});:SetHidden(_IncidentRoomLocation, ${MainHide});:SetHidden(_WorkingFromHome, ${MainHide});:SetHidden(ConfigurationItem, ${MainHide});:SetHidden(ConfigurationItem.Title, ${MainHide});:SetMandatory(_PhoneNumber, ${MainMan});:SetMandatory(CreationUser, ${MainMan});:SetMandatory(_IncidentFloorLoc, ${MainMan});:SetMandatory(_IncidentRoomLocation, ${MainMan});:SetMandatory(_WorkingFromHome, ${MainMan});:SetMandatory(ConfigurationItem, ${MainMan});:SetMandatory(_Computer1._Manufacturer, ${MainMan});:SetMandatory(_Computer1._Model, ${MainMan});:SetMandatory(_Computer1._IPAddress, ${MainMan});:SetMandatory(ConfigurationItem.Title, ${MainMan});:SetHidden(_Computer1._Manufacturer, ${MainHide});:SetHidden(_Computer1._Model, ${MainHide});:SetHidden(_Computer1._IPAddress, ${MainHide});:SetHidden(ConfigurationItem.Title, ${MainHide});:SetHidden(_Location, ${MainHide});:SetHidden(_Asset.Title, ${MainHide});:SetHidden(_Computer1.Title, ${MainHide});"

              return instructions

             

             

            The problem I'm having at the moment is the searching of the linking object. I think that it's my syntax as it's a user defined attribute and object. Something to do with the "Using the Function as a Result" section here Calculation Writing Tutorial - 8.  Working with Dropdown Lists (Objects)

             

            Anyone fancy a go at helping me?

            • 3. Re: multi select list box display for dynamic window rule
              John Stuart-Robson Employee

              Hi All,

               

              It is possible to hide the MultiSelect List box.  In your window calculation, you need to reference the collection the multiselect list box is using.

               

              Here is an example calculation, with thanks to Mr ASWINDELLS for discovering it:

               

                      if Problem._ProblemSingleorMultipleAssets1 != null:
               if Problem._ProblemSingleorMultipleAssets1._ProblemSingleorMultipleAssets == 'Multiple':
               HideMultiple = false
              
               instructions += String.Format(":SetHidden(_ConfigItemCol, {0});", HideMultiple)
              
              

               

              Good Luck!

               

              John

               

              :-)

               

              Edit:  Not sure about hiding if a value exists. Sorry!

              • 4. Re: multi select list box display for dynamic window rule
                jasoncadman Expert

                Thanks John, I'd got to that bit - think that we crossed in the post

                • 5. Re: multi select list box display for dynamic window rule
                  jasoncadman Expert

                  Oops. I'm searching for the details on the parent incident, not the child that has the entry in the object link table - slight error!

                   

                  the problem is still the same though. I'm struggling to get the syntax right on this:

                   

                  LinkIDResults = Incident.GetObjectByAttribute("IncidentManagement._IncidentSystmOneUnitLink", "_Incident", LinkIDtoSearch)


                  The _IncidentSystmOneUnitLink object is my object linking object and links to incidents to my reference list. I'm not sure whether to use the incident reference number or the incident guid to search the table and also what syntax to use as this is a user created object


                  At least I've narrowed the question down though


                  I probably need some StuMcneill expertise


                  • 6. Re: multi select list box display for dynamic window rule
                    jasoncadman Expert

                    I've been talking to support and it looks like you can get the functionality that I need with the user of an object filter which is going to make life a fair bit easier

                     

                    Would be nice to get an answer though if anyone is feeling generous