From fa4aabb64e2e95e78c5e059be9d2098eaa86eb5c Mon Sep 17 00:00:00 2001 From: jaymed Date: Mon, 15 Aug 2016 14:57:54 -0700 Subject: [PATCH] support for multi/single choice custom fields Add support for multi/single choice custom fields. --- .../Rest/JiraRestProxy.cs | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/VersionOne.JiraConnector/Rest/JiraRestProxy.cs b/VersionOne.JiraConnector/Rest/JiraRestProxy.cs index c0433cc..d079bf2 100644 --- a/VersionOne.JiraConnector/Rest/JiraRestProxy.cs +++ b/VersionOne.JiraConnector/Rest/JiraRestProxy.cs @@ -102,15 +102,39 @@ public Issue UpdateIssue(string issueKey, string fieldName, string fieldValue) dynamic body; if (type.ToString().Equals("array")) { - dynamic operation = new ExpandoObject(); - ((IDictionary)operation).Add(fieldName, new List + var custom = fieldMeta.schema["custom"]; + + if (custom != null && (custom.ToString().Equals("com.atlassian.jira.plugin.system.customfieldtypes:multiselect"))) + { + dynamic operation = new ExpandoObject(); + ((IDictionary)operation).Add(fieldName, new List + { + new + { + set = new List { new { value = fieldValue} } + } + }); + body = new { update = operation }; + } + else if (custom != null && (custom.ToString().Equals("com.atlassian.jira.plugin.system.customfieldtypes:select") || + custom.ToString().Equals("com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes"))) + { + dynamic field = new ExpandoObject(); + ((IDictionary)field).Add(fieldName, new { value = fieldValue }); + body = new { fields = field }; + } + else { - new + dynamic operation = new ExpandoObject(); + ((IDictionary)operation).Add(fieldName, new List { - set = new List { fieldValue } - } - }); - body = new { update = operation }; + new + { + set = new List { fieldValue } + } + }); + body = new { update = operation }; + } } else {