4 Replies Latest reply on Jan 21, 2016 3:17 PM by daveb1

    Update ticket status using C#

    hilll Rookie



      Not sure if this is possible or not but I was wondering if anyone has tried this. I have a C# application which is used by our service desk to do certain tasks and I'd like to be able to update the ticket status once the task has been completed.


      At the minute I'm able to Connect to HEAT, bring back ticket details and raise a ticket in C# using the FRSHEAT reference.


      Does anyone know how to SET the status?




        • 1. Re: Update ticket status using C#
          florian1 Expert

          Are you using SOAP or REST?

          • 2. Re: Update ticket status using C#
            hilll Rookie

            Thanks for the response Florian, I've managed to work it out


            Code for anyone interested.






                string username = "";

                string password = "";

                string tenant = "";

                string role = "";

                string ticketNo = "";

                string key = null;



                FRSHEATIntegration frSvc = new FRSHEATIntegration();



                FRSHEATIntegrationConnectionResponse connectresponse = frSvc.Connect(username, password, tenant, role);



                if (connectresponse.connectionStatus == "Success")




                    key = connectresponse.sessionKey.ToString();



                    ObjectQueryDefinition changeQuery = new ObjectQueryDefinition();

                    FieldClass[] changeFieldObjects = new FieldClass[]


                        new FieldClass()


                            Name = "RecId",

                            Type = "Text"





                    changeQuery.Select = new SelectClass();

                    changeQuery.Select.Fields = changeFieldObjects;

                    changeQuery.From = new FromClass();



                    changeQuery.From.Object = "servicereq";

                    changeQuery.Where = new RuleClass[]


                        new RuleClass()


                            Condition= "=",

                            Field = "ServiceReqNumber",

                            Value = ticketNo





                    FRSHEATIntegrationSearchResponse changeSearchResponse = frSvc.Search(key, tenant, changeQuery);



                    WebServiceBusinessObject[][] changeList = changeSearchResponse.objList;



                    WebServiceBusinessObject change = changeList[0][0];

                    string changeRecId = change.RecID;



                    ObjectCommandData data = new ObjectCommandData();

                    data.ObjectType = "ServiceReq#";

                    data.ObjectId = changeRecId;



                    List<ObjectCommandDataFieldValue> dataFields = new List<ObjectCommandDataFieldValue>();

                    Dictionary<string, object> fields = new Dictionary<string, object>();



                    fields["Status"] = "Fulfilled";



                    foreach(string a in fields.Keys)


                        dataFields.Add(new ObjectCommandDataFieldValue()


                            Name = a,

                            Value = fields[a].ToString()





                    data.Fields = dataFields.ToArray();



                    FRSHEATIntegrationUpdateBOResponse response = frSvc.UpdateObject(key, tenant, data);



                    if (response.exceptionReason != null)








                    MessageBox.Show("Error connecting.");



            catch(Exception ex)




            2 of 2 people found this helpful
            • 3. Re: Update ticket status using C#
              florian1 Expert

              Alright, so you're using SOAP. You could use REST as well - that's why I was asking.


              To make things like this easier I can recommend you to use soapUI in the first place.

              -> If everything is functioning here as it should you can start writing your own code.

              • 4. Re: Update ticket status using C#
                daveb1 Apprentice

                So HEAT SM supports REST?  I was told by company reps that was something they were working on.  Where is this documented?