3 Replies Latest reply on Mar 4, 2013 2:56 AM by delms

    Calculation for isParent not returning a value...

    Apprentice

      I have created 4 new Attributes on my Incident window, all of which have calculations on

       

      Child Count - to count the number of Child Incidents

      isParent? - a boolean, which should be set to "true" if there is more than 0 children

      Parent Count - to count the number of Parent Incidents

      isChild? a boolean, which should be set to "true" if there is more than 0 parents

       

      I have a couple of issues

       

      1) Neither of the isParent? or isChild? attributes are displaying correctly (i.e. when they are made a parent or child the check box doesn't enable even though the count is working)

       

      import System

      static def GetAttributeValue(Incident):

           if Incident._ParentCount >0:

                return true

           else:

                return false

      The Syntax shows no errors, but the attribute doesn't update.  Attribute properties are below. (assume the same for the isParent? attribute)

        Capture.JPG

      2)  My second issue is that my Parent/Child Count queries only increase, if a parent or child is detached then the counts don't decrease.  Do I need to add another calculation on the Process Action for Detach Parent/Child to remove as required?

      Fairly new to calculations so please be gentle!

        • 1. Re: Calculation for isParent not returning a value...
          Expert

          I think the 1st item is a timing issue.  If you make a change to the incident and then save it again does the calculation work?  If so, I have seen before and there is no fix (other than making a change and hitting save).

           

          The second item would be true.  Service desk rarely deletes data.  Typically there is a flag that is used to show if a record is deleted.  Example: If you create a user called XXYYZZ, save it, delete it.  Then you go and try to create a user called XXYYZZ again, it fails because the record already exists.  It is soft deleted so you don't see it but it's there.  The same is true with other objects.  We would say that it is working as intended although not as expected.

          • 2. Re: Calculation for isParent not returning a value...
            ITSMMVPGroup

            I'd check the dependencies of the calcualtion.  It needs to fire when the business object for the parent/child relationship is updated.  If you also turn on TPS calculation diagnostics, you can sometimes see no evidence of a calculation happening, when you think it should(which tells you something!)

            • 3. Re: Calculation for isParent not returning a value...
              Apprentice

              I established that there ism't anything wrong with the calculation, it was just that I needed to change it to an "After Read" rather than "Before Save"

               

              Is now working great, except for the fact that parents stay parents even when their children are orphaned...