3 Replies Latest reply on Aug 30, 2016 9:22 AM by Justin Blackburn

    Setting an Incident number from a Task Collection item

    Jamie Cannon ITSMMVPGroup

      Has anyone ever had this scenario?

       

      I have an Incident created and then I create a task on that incident <-- easy enough.

       

      Next, inside of that task I have a collection item (like a note) <-- easy enough

       

      Well, now on this Incident Task Note window, I want to be able to show the Task number (this is automatic) and an Incident number that shows based on the task number.  This is the part I'm having issues with.  It seems as though the system can refer back to getting something like Task.Title but it can't use a copy rule to set an Incident reference based on the Task number.

       

      Has anyone seen this and if so were you able to get around it?

       

      Thanks!

      Jamie

        • 1. Re: Setting an Incident number from a Task Collection item
          Markus.Gonser ITSMMVPGroup

          Hi Jamie,

           

          if you only need the Incident-ID as Information on the Task Note, then you could add a new attribute (String - 50) to the "Task Incident" - Object.

          In there you will create a "After Read" - calculation and return the ID of the Incident in a "String.Format("{0}", Task.Incident.Id).

          You could now add this new attribute to your Task Note window and it will show the incident and the task id at the same time.

           

          best regards

          Markus

          • 2. Re: Setting an Incident number from a Task Collection item
            Jamie Cannon ITSMMVPGroup

            So ultimately what I needed was for a request drop down to be populated with the Incident number based on the Task number on a Task.Note collection item.  I was able to do this with doing the following (for anyone who needs it).

             

            1.  On the Task object I created a new String attribute called calcIncGUID and added to the form.

            2.  On the task process, I set up an an auto action that will set the field to be the GUID using this calc:

                      import System

                      static def GetAttributeValue(Task):

                            Value = Task.Incident.Guid.ToString()

             

            3.  On the Task Note, created a new boolean called "Show Incident" and added to the Task Note form as Is Calculate on Change

            4. Created a relationship from Incident to Task Note and created a BeforeSave calc with this code:

             

                      import System

                      static def GetAttributeValue(TaskNote):

                            Value = null

                           

                            ObjectGUID as System.Guid

                           

                            if TaskNote._ShowIncident != null:

                                            if TaskNote._ShowIncident == true:

                                                           

                                            //READING THE STRING GUID CALC VALUE          

                                                            Value = TaskNote._ShowInciden._Task1._calcIncidentGuid

                                                           

                                            //SETS AS GUID TYPE VALUE

                                                            ObjectGUID = Guid.Parse(Value)

                           

                            return TaskNote.GetObjectByAttribute("InicdentManagement.Incident", "Guid", ObjectGUID)

             

            5.  Added all the attributes to the form.

             

            Once I select the boolean, the Incident number gets populated on the Task Collection form for the Task.

             

            Hope it helps.

            1 of 1 people found this helpful
            • 3. Re: Setting an Incident number from a Task Collection item
              Justin Blackburn Rookie

              This was the exact solution needed to complete a project I was working on! Great work!