3 Replies Latest reply on Apr 28, 2016 11:59 AM by lewism3

    HEAT API - How To get Related CI Objects from Change Record

    lewism3 Rookie

      Hello,

       

      I am working with the HEAT API.  I was able to successfully get a list of all of the change records.  Now my next step is how to get the Related CI objects/records foreach Change Record.

       

      This is the .Net C# code I am using to get just a single Change Record. 

       

      FRSHEATIntegrationSearchResponse res = frSvc.FindMultipleBusinessObjectsByField(AuthSessionKey, "tenantId", "Change", "ChangeNumber", "12345");

       

      I can get the RecId from the FieldValues.  My thought is that I could use this RecID and search another table/entity/BusinessObject to get a list of the of RelatedObjects.  I am ok if this list is another List of RecID. 

       

      Any help would be appreciated?

        • 1. Re: HEAT API - How To get Related CI Objects from Change Record
          florian1 Expert

          I don't think FindMultipleBusinessObjects() is capable of using relationships.

          You could do a second query for each object and fill your own two-dimensional array but I wouldn't recommend it.

           

          You should rather use the Search() method.

          Have a closer look at the Admin Help:

          "Scenario 3: Searching Against a Single Business Object and its Related Child Objects, Returning One Exact Match for the Parent Business Object" for example.

          You will receive a two-dimensional array containing the master object(s) and the related child record(s). ;-)

          • 2. Re: HEAT API - How To get Related CI Objects from Change Record
            lewism3 Rookie

            I am ok with doing a second query to get the child objects.  I just don't how to get the child objects.  Would you happen to know where Admin Help is located?  can it be downloaded?

            • 3. Re: HEAT API - How To get Related CI Objects from Change Record
              lewism3 Rookie

              I was able to get one our guys to open up a Support Ticket with the HEAT team and I got a solution.  Here is a sample, in case anyone is interested:

               

              The solution was to add use the Query option and adding the Link to the CI Tables.  The sample code below will only bring back the one Change Record based on the Change Record Number.

               

              ObjectQueryDefinition query = new ObjectQueryDefinition();

                          query.Select = new SelectClass();

                          query.Select.All = true;

                          query.From = new FromClass();

                          query.From.Object = "Change";

                          query.From.Links = new FromLinkClass[] { new FromLinkClass() { Relation = "", Object = "CI#", RelationshipName = "ChangeAssociatedCI" } };

                          query.Where = new RuleClass[]{

                                      new RuleClass()

                                       {

                                       Join = "AND",

                                       Condition = "=",

                                       Field = "ChangeNumber",

                                       Value = ChangeNumber.ToString()

                                      }

                          };

               

              FRSHEATIntegrationSearchResponse searchResponse = frSvc.Search("sessionKey", "TenantID", query);