Create a Query to view only Parent Incidents or Incidents with no Children

Version 3

     

    Environment:

     

    Service Desk 7.4 and above

     

    Question:

     

    Can I create a Query to see only Parent Incidents and Incidents that do not have Child Incidents?

     

    Answer:

     

    Yes, this is possible to do; by creating a Calculation that is looking for Child Incidents, if there is no Child Incidents then it returns a Value of false and we can create a query based on that criteria, to implement please see below steps ......

     

    Note: To implement this we will need to make changes in the following areas.

     

     

    Ø  Object Designer   (To create a new attribute for our Calculation)

    Ø  Window Manager (To modify the Incident Window)

    Ø  Query Designer   (To create our new Query)

     

    Step 1 Object Designer

     

    1.       Within Designers navigate to Object Designer, Expand Incident Management and Double Click Incident.

    2.       Within the Actions Pane click New Attribute and name this “Is Child Incident”

    3.       Within the Properties of your new Attribute, set the following.

     

    1.  Data Type = Boolean

    2. Calculation Type = Before Save

    3. A Calculation Window will appear, copy and paste the below calculation (Please note that calculations are dependent on the indentations, it’s recommended you test the syntax to ensure the Calculation has been copied over correctly)

     

     

    import System
    static def GetAttributeValue(Incident):
             Value = false
             for ParentLink in Incident.Parents:                           
                        if Value == false:
                                Value = true       
                    return Value
    

     

     

    4. In the Dependencies, type in Children and Parents. (Please below screenshot to see how the Calculation Window should look)

    calculation.jpg 

     

     

    4.    5. Press OK and then Press the Save Icon to save the new attribute we have just created.

     

    Please note that where our calculation has a dependency of Parents and Children, the Calculation will only be fired once a Child has been created from an incident, additionally where our calculation is set to “Before Save” the “Is Child Incident” box will be ticked once pressing save.

     

    Step 2 Window Manager

     

    1.       Within Designers, Navigate to Window Manager.

    2.       Locate your Incident Window, from within the Action pane, click Modify Window.

    3.       From within the Attributes pane, locate our new Attribute “Is Child Incident” and move this into the required position of the Window.

    4.       Save the Window.

     

    We are now in position where once a Child Incident has been created, the box will be ticked and we can create a query to only show Parent Incidents and Incidents with no Children.

     

     

    Step 3 Query Designer.

     

    Please note: Here we can go and modify an existing query, if wish to do this please go to Step 4 to specify Criteria or if you're creating this from new please see below.

     

    1.  

            1.   Within Designers, locate Query and Report Designer.

            2.  Create a New Query under System query, the Query will be based on the Incident Management Module and Incident Business Object, then fill in the rest of the     criteria as desired.

     

     

    Query.JPG

     

     

     

     

            3. Choose the Attributes you wish to report on i.e. Reference Number, Raiser User etc.

    4.     4. Press Next and Next again so you can specify Criteria.

            5. Locate the “Is Child Incident” attribute and a Criteria Window will appear, please set the below

    i.               

                      i.  Condition: = Is Equal to

              ii.  Value: = False.

     

    6.      6. Press OK and Save your query.

    7.      7. Done.

     

     

    I would like to apply the calculation to my existing incidents, how can I do this?

     

    If you have current Incidents open and would like to see these incidents in the query as well, it’s required that we run a scheduled action on the incidents to apply the calculation thus seeing these in our query, please see below steps… it's recommended the below is carried out of hours, so no one is using LANDesk Service Desk this is because Child Incidents may potentially be created and the Calculation will not fire as we need to change the calculation type from Before Save to Scheduled.

     

    Please ensure that Background Services is running

     

    1.    1.  Navigate to Object Designer and locate the “Is Child Incident” attribute and set the Calculation Type to “Scheduled” from “Before Save”.

     

    2.    2.  Navigate to Administration and select Schedule Manager, within the Action Pane, click on New Scheduled Bulk Action fill in the required fields for Name, Description and set the Schedule by choosing an appropriate date and time.

     

    3.    3.  Then within the Bulk Action set the following

     

    Module = Incident Management.

    Business Object = Incident.

    Scheduled Action Type: = Perform Calculation.

    Click on the Calculations Button and select “Is Child Incident”

     

    4.    4. Save and let the Bulk action run.

    5.    5. Once this has successfully ran, change the Calculation Type to Before Save again from Object Designer. (You can see the results by expanding your Schedule tree and double clicking the page icon with date and time next to it)

    6.    6. Additionally we would only need to run this once, so we can delete the Bulk Action.