5 Replies Latest reply on Feb 5, 2015 4:49 AM by elizabethcombrink

    Survey Required Calculation Help

    Rookie

      Hi

       

      We are using 7.6.1 upgraded from 7.4.  The Full Incident process from an OOTB install was transferred into our 7.6.1 during the upgrade, and at the time we had no requirements for Surveys so those bits were removed from the process.

       

      Since then, there has been a u-turn with regards to surveys.  We will now be randomly sending out a survey invite, it's going to be a link to a survey developed in another system.  I've got the reminder setup correctly and it's passing over the incident reference number etc.  it's just the calculation for the decision that is causing me problems.

       

      I've read through http://community.landesk.com/support/docs/DOC-26763 and http://community.landesk.com/support/docs/DOC-24969, which seem to make sense, i had a look at an OOTB system I found that our User object was missing the Do Not Survey attribute, so I have created this.

       

      For purposes of testing, I have set the frequency to be 1 in 2 incidents will generate the survey:

       

      import System

      static def GetAttributeValue(Incident):

      Frequency = 2

      is_divisible = false

      if Incident.RaiseUser != null:

        if Incident.RaiseUser._DoNotSurvey == null:

         is_divisible = (Incident.Id % Frequency == 0)

        if Incident.RaiseUser._DoNotSurvey != null:

         if Incident.RaiseUser._DoNotSurvey.ToString() == 'False':

          is_divisible = (Incident.Id % Frequency == 0)

      return is_divisible

       

      When an Incident reaches this part of the process, it generates this error:

       

      There has been an unexpected error. Click Continue to return to the previous page.

      There is an error in XML document (1, 1).

       

      I altered the calculation, to try and strip out the part about Do No Survey, in at attempt to narrow it down.

       

      import System

      static def GetAttributeValue(Incident):

      Frequency = 2

      is_divisible = false

      if Incident.RaiseUser != null:

         is_divisible = (Incident.Id % Frequency == 0)

      return is_divisible

       

      But I still get the same error as above, and the Show Details gives me this:

       

      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

      at Touchpaper.Framework.Data.SDataObjectRef.Parse(String xml)

      at Touchpaper.Framework.Data.DataObject.ConvertValueFromString(DataType dataType, String value)

      at Touchpaper.Framework.Data.DataObject.CompareConditionValues(DataType dataType, String valueString, Object attributeValue, ICondition condition)

      at Touchpaper.Framework.Data.DataObject.EvaluateCalculationCondition(ICondition condition)

      at Touchpaper.Framework.Data.DataObject.EvaluateCondition(ICondition condition, Boolean ignoreCalculationCondition)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransitionStep(ITransitionStep step, Object param1, Object param2, Boolean validateOnly, IList`1 automaticActionsList)

      at Touchpaper.Framework.Data.DataObject.ProcessLifecycleTransition(ITransition transition, Object param1, Object param2, Boolean validateOnly)

      at Touchpaper.Framework.Data.DataObject.TriggerLifecycle(DataObject dataObjectRelated)

      at Touchpaper.Framework.Data.DataObject.OnInserting(IDataObjectContext context)

      at Touchpaper.Framework.Data.DataObjectContext.FireEvents(IList listToUpdate, IList listMutualDependencies, IDictionary`2 objectsProcessedPreviously)

      at Touchpaper.Framework.Data.DataObjectContext.SaveChanges()

      at Touchpaper.Web.Console.Controllers.ObjectController.SaveInternal(ObjectParameters parameters, Func`3 getObject)

      at Touchpaper.Web.Console.Controllers.ObjectController.Apply()

      at lambda_method(Closure , ControllerBase , Object[] )

      at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)

      at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.b__36(IAsyncResult asyncResult)

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.b__20()

      at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.b__22(IAsyncResult asyncResult)

       

      Inner Exception: - Data at the root level is invalid. Line 1, position 1.

      at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)

      at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()

      at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

      at System.Xml.XmlReader.MoveToContent()

      at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSDataObjectRef.Read14_dor()

       

      My experience of using Calculations goes as far as doing some dynamic window work which went smoothly.  But I'm not experienced enough to make sense of the error message.

       

      I'm assuming that i've made a glaring mistake (likely), or that something is missing from our 7.6.1 as we upgraded from 7.4.

       

      Can anyone point me in the right direction.

       

      Thanks

      Pete

        • 1. Re: Survey Required Calculation Help
          Rookie

          Okay, I've made a bit of progess.  The calculation works fine if I put it in a Precondition, so in my process now, I have a pre-condition with the calculation in, which then offers a manual action of Take Survey, which in turn triggers a reminder with the link in.  That works fine.

           

          So now I've moved the Decision in the process, and it works fine too.

           

          Ignore me now!

          • 2. Re: Survey Required Calculation Help
            Stu McNeill Employee

            Hi Pete,

             

            I'm glad you were able to get around this.  Just to confirm and in case anyone comes across this in the future...,

             

            The XML error will have been because the calcualtion is failing for one reason or another.  You should be able to see the reason why by testing the calculation in the editor or turning on calculation logging.  See this document for more details: "There is an error in XML document (1, 1)." error when a calculation process condition is being evaluated.

             

            Thanks

            • 3. Re: Survey Required Calculation Help
              Mroche SupportEmployee

              This error occurs due to the calculation on the 'Survey?' condition attempting to divide the Incident.Id by the Frequency when the Incident.Id does not exist yet.  This happens if you place the survey condition too early in the process; specifically before any manual actions or a status.

               

              An example of this would be if you have the open status followed by a 'Resolve on Creation' decision that is followed by an automatic 'Resolve' action and then the 'Survey?' decision.

               

              Running dianostic logging for calculations will return an 'Object reference not set to an instance of an object' when the process is designed this way.  To resolve the issue at least one manual action has to occur prior to the 'Survey?' condition

              • 4. Re: Survey Required Calculation Help
                Rookie

                Bring this back now (sorry, not been able to do any servicedesk work for a long time)

                 

                It makes sense now that the incident.id doesn't exist, so the calculation fails.  Our current Incident process doesn't have a Resolve action and then Closed.  We don't have resolved anywhere for some reason (management decision), so it's removed from our process.

                 

                Is there anyway of getting the incident.id generated before the incident is closed?  Maybe having a mixture of automatic action/status before the Survey Decision (I realise it may be necessary to have some pre-conditions in to get around not being able to join certain things in process designer).

                 

                I've tried, and failed.  Before I try again, does this even sound possible?

                 

                ta

                Pete

                • 5. Re: Survey Required Calculation Help
                  elizabethcombrink Employee

                  You are only using the id to calculate if the survey is sent or not. And the reason for this is to simulate randomness, which it clearly isn't as its 100% predictable.

                   

                  Other options to consider :

                  Look at c++ function to calculate a random number (0 or 1 for a 50% chance) instead?

                   

                  Or consider sending the survey as an optional link in every closure email and let people decide if they want to fill it in or not and remove that condition completely.

                   

                  Let me know how you get on