public void DisplayIncident(int incId) { //First fetch the incident we want to update RNOWIncident incident = new RNOWIncident(incId); incident = (RNOWIncident)_objectFactory.get(incident); lstResults.Items.Add("\n Incident Id: " + incId); lstResults.Items.Add("Incidnet Tracking number : " + incident.Subject); List <RNOWThread> threads = incident.Threads; foreach (RNOWThread thread in threads) { lstResults.Items.Add("\n--------------------Begin Thread Data--------------------"); lstResults.Items.Add("Thread Sequence: " + thread.Seq); lstResults.Items.Add("Thread Note: " + thread.Note); lstResults.Items.Add("Thread Entered Date: " + thread.Entered); lstResults.Items.Add("--------------------End Thread Data--------------------\n"); } }
private void UpdateIncident(int incId, string Trackingnumber) { //First fetch the incident we want to update RNOWIncident incident = new RNOWIncident(incId); incident = (RNOWIncident)_objectFactory.get(incident); if (incident == null) { lstResults.Items.Add("Incidnet with id: " + incId + " was not found."); return; } /* * //Set the new subject on the incident object * incident.Subject = subject; * * //Create a new list for newly appended threads. * //Do not try and add the new thread directly by doing incident.Threads.Add(newThread) * List<RNOWThread> threads = new List<RNOWThread>(); * threads.Add(incThread); * incident.Threads = threads; * * //Send the updated incident object back to RightNow * _objectFactory.update(incident);*/ // declare the incident object RNOWIncident IncObj = new RNOWIncident(); // delcare the custom field objects RNOWCfVal CfObj = new RNOWCfVal(); List <RNOWCfVal> CfsObj = new List <RNOWCfVal>(); IncObj = new RNOWIncident(); CfsObj = new List <RNOWCfVal>(); IncObj.ID = incId; _objectFactory.get(IncObj); // get the custom fields CfsObj = IncObj.CustomField; // update the custom fields CfsObj = new List <RNOWCfVal>(); // init cf obj, set a TEXT custom field, add it to the cf list CfObj = new RNOWCfVal(); CfObj.CfId = 67; CfObj.ValStr = Trackingnumber; CfsObj.Add(CfObj); // set the incident custom field property IncObj.CustomField = CfsObj; // update the incident lstResults.Items.Add("If you see a value of 1, the Incident updated successfully: " + _objectFactory.update(IncObj)); // print the custom fields lstResults.Items.Add("Custom Field Count: " + CfsObj.Count); for (int i = 0; i < CfsObj.Count; i++) { lstResults.Items.Add("*** CUSTOM FIELD " + i); lstResults.Items.Add("CfId: " + CfsObj[i].CfId); lstResults.Items.Add("DataType: " + CfsObj[i].DataType); // lstResults.Items.Add ("ValInt: " + CfsObj[i].ValInt); lstResults.Items.Add("The RightNow incident has been updated: " + CfsObj[i].ValStr); } // lstResults.Items.Add ("ValTime: " + CfsObj[i].ValTime); }