我在UserStory中使用“weblink”类型创建了用户定义字段。我在“自定义”部分中看到此字段。 我写了下一个代码来更新这个字段。
QueryRequest storyRequest = new QueryRequest("HierarchicalRequirement");
storyRequest.setFetch(new Fetch("TestRailsRef"));
storyRequest.setQueryFilter(new QueryFilter("FormattedID", "=", "US1"));
QueryResponse storyQueryResponse = restApi.query(storyRequest);
JsonObject storyJsonObject = storyQueryResponse.getResults().get(0).getAsJsonObject();
String storyRef = storyJsonObject.get("_ref").getAsString();
JsonObject updatedDefect = new JsonObject();
updatedDefect.addProperty("LinkID", "280");
updatedDefect.addProperty("DisplayString", "Link to TestRails");
JsonObject updatedTestRailRef = new JsonObject();
updatedTestRailRef.add("c_TestRailsRef", updatedDefect);
UpdateRequest updateRequest = new UpdateRequest(storyRef, updatedDefect);
UpdateResponse updateResponse = restApi.update(updateRequest);
我在updateResponse
中看到了警告"{"OperationResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [], "Warnings": ["It is no longer necessary to append \".js\" to WSAPI resources.", "Ignored JSON element hierarchicalrequirement.LinkID during processing of this request.", "Ignored JSON element hierarchicalrequirement.DisplayString during processing of this request."]
为什么?
答案 0 :(得分:0)
WebLink类型字段由两部分组成:LinkID和DisplayString。为了设置LinkID,需要将DisplayString设置为空字符串。
也许this post会有所帮助。