private IList <IReportRow2> getRows(IList <string> columns, IReportFilterNode filterNode) { IList <IReportRow2> reportRows = new List <IReportRow2>(); IRecordContext _context = ((SrmReportTablePackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace; IIncident incidentRecord = null; int convId = 0, bundleId = 0; String endpoint = null; if (_context != null) { incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident; convId = ConfigurationSetting.getSrmCustomAttr(incidentRecord, "srm_conversation_id"); bundleId = ConfigurationSetting.getSrmCustomAttr(incidentRecord, "srm_bundle_id"); if (convId == 0 || bundleId == 0) { return(reportRows); } } else { if (filterNode != null && filterNode.FilterNodes != null) { IReportFilterNode convIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ConversationID", this.Parent.Name, this.Name)); if (convIDFilterNode != null) { convId = Convert.ToInt32(convIDFilterNode.ReportFilter.Value); } if (convId == 0) { return(reportRows); } IReportFilterNode bundleIDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.BundleID", this.Parent.Name, this.Name)); if (bundleIDFilterNode != null) { bundleId = Convert.ToInt32(bundleIDFilterNode.ReportFilter.Value); } } } endpoint = String.Format(ConfigurationSetting.convReplyGETEndpoint, convId, bundleId, ConfigurationSetting.max_srm_rows_fetch); // determine whether to close or re-open a conversation String jsonStr = "{\"status\" : \"active\"}"; HttpContent content = new StringContent(jsonStr, Encoding.UTF8, "application/json"); ConfigurationSetting.logWrap.DebugLog(logMessage: Accelerator.SRM.SharedServices.Properties.Resources.GETRequestMessage, logNote: endpoint); var results = RESTHelper.PerformGET(endpoint, ref ((SrmReportTablePackage)this.Parent)._globalContext); if (results != null) { if (!results.Success) { MessageBox.Show(Properties.Resources.GetRowsError, Properties.Resources.Error); ConfigurationSetting.logWrap.ErrorLog(logMessage: "Response GET Conversation message error", logNote: results.JSON); } var jsonData = results.JSON; if (jsonData == null || jsonData == "") { return(reportRows); } JavaScriptSerializer ser = new JavaScriptSerializer(); RootObject replies = ser.Deserialize <RootObject>(jsonData); foreach (Item req in replies.items) { ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count); object reportDataKey = req.id; foreach (var column in columns) { ReportDataCell reportDataCell = new ReportDataCell(); switch (column) { case "SRM_Data$SrmRepliesListTable.ReplyID": reportDataCell.GenericValue = req.content.id; break; case "SRM_Data$SrmRepliesListTable.liked": reportDataCell.GenericValue = Convert.ToBoolean(req.content.liked); break; case "SRM_Data$SrmRepliesListTable.likesCount": reportDataCell.GenericValue = Convert.ToInt32(req.content.likesCount); break; case "SRM_Data$SrmRepliesListTable.authorName": reportDataCell.GenericValue = req.content.author.name; break; case "SRM_Data$SrmRepliesListTable.authorImage": reportDataCell.GenericValue = req.content.author.authorImage; break; case "SRM_Data$SrmRepliesListTable.attachmentType": reportDataCell.GenericValue = req.content.attachments != null ? req.content.attachments[0].type : null; break; case "SRM_Data$SrmRepliesListTable.attachmentUrl": reportDataCell.GenericValue = req.content.attachments != null ? req.content.attachments[0].url : null; break; case "SRM_Data$SrmRepliesListTable.authorProfileUrl": reportDataCell.GenericValue = req.content.author.authorProfileUrl; break; case "SRM_Data$SrmRepliesListTable.externalId": reportDataCell.GenericValue = req.content.externalId; break; case "SRM_Data$SrmRepliesListTable.type": reportDataCell.GenericValue = req.content.type; break; case "SRM_Data$SrmRepliesListTable.postedAt": DateTime utcTime = DateTime.Parse(req.content.postedAt); DateTime localTime = utcTime.ToLocalTime(); reportDataCell.GenericValue = localTime != null?localTime.ToString() : ""; break; case "SRM_Data$SrmRepliesListTable.status": reportDataCell.GenericValue = req.content.status; break; case "SRM_Data$SrmRepliesListTable.body": reportDataCell.GenericValue = req.content.body; break; case "SRM_Data$SrmRepliesListTable.labels": if (req.content.labels.Count == 0) { reportDataCell.GenericValue = "No Value"; } else { foreach (String label in req.content.labels) { reportDataCell.GenericValue += ", " + label; } } break; } reportDataRow.Cells.Add(reportDataCell); } //Please set the Key, it is necessary to edit report cell reportDataRow.Key = reportDataKey; reportRows.Add(reportDataRow); } } return(reportRows); }