How can we get the Property values of a Incident Area and also update them via web services?

Document ID : KB000052229
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Following is the code in order to update or get the properties of the Incident Area.

Solution:

public String updateIncidentProperties(String TicketNumber, String PropLabel, 
String[] attrVals, String[] attributes)
        {
            String status = "";
            String strxml = "";
            String objectHandle;
 
            connectUsd();
            try
            {
                objectHandle = getIncidentPropertyHandle(TicketNumber, PropLabel);
                strxml = ws.updateObject(sid, objectHandle, attrVals, attributes);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: updateIncidentProperties: ");
                Console.WriteLine(" " + ex.Message.ToString());
            }
            return status;
        }
 
        public String getIncidentPropertyHandle(String TicketNumber, String PropertyLabel)
        {
            String sym = "";
            String ticketHandle = "";
            String propHandle = "";
 
            connectUsd();
            try
            {
                ticketHandle = getObjectHandle("cr", "ref_num='" + TicketNumber + "'");
                sym = "owning_cr='" + ticketHandle + "' and label='" + PropertyLabel + "'";
                propHandle = getHandle(true, "cr_prp", sym);
 
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: Test: ");
                Console.WriteLine(" " + ex.Message.ToString());
            }
            return propHandle;
        }
        
        public String getObjectHandle(String type, String query)
        {
            String ObjectHandle = "";
            String[] serverArray;
            String strxml;
            XmlDocument Doc;
            XmlNode xmlNode;
 
            Doc = new XmlDocument();
            serverArray = new String[1];
            strxml = ws.doSelect(sid, type, query, 1, serverArray);
            if (strxml.Length > 0)
            {
                Doc.LoadXml(strxml);
                xmlNode = Doc.SelectSingleNode("UDSObjectList/UDSObject/Handle");
                if (xmlNode != null)
                {
                    //-- To get the Category Handle
                    ObjectHandle = xmlNode.InnerText.ToString();
                }
            }
            return ObjectHandle;
        }