I’ve configured a custom weblink field for defect in Rally. And i would like to use Rally rest .net api to submit new defect with value of custom weblink field accordingly to Rally.
Unluckily that weblink instance needs LinkID and DisplayString value, i don’t know how to initiate a weblink instance to set for the field of defect.
I also have tried to set a DynamicJsonObject which is supported by Rally rest .net api to that field but it still failed.
The debugging screenshot

Please help!
Edited:
I’ve tried posting defect with the sample code as below:
var api = new RallyRestApi("<myusername>", "<mypassword>", "https://community.rallydev.com");
var defect = new DynamicJsonObject();
defect["Name"] = "Sample Defect";
defect["Description"] = "Test posting defect with weblink type field";
defect["Project"] = "https://trial.rallydev.com/slm/webservice/1.29/project/5839639589.js";
defect["SubmittedBy"] = "https://trial.rallydev.com/slm/webservice/1.29/user/5797741589.js";
defect["ScheduleState"] = "In-Progress";
defect["State"] = "Open";
defect["Severity"] = "Major Problem";
defect["Priority"] = "High Attention";
defect["CustWebLink"] = new DynamicJsonObject(new Dictionary<string, object>
{
{"DisplayString", "abc"},
{"LinkID", "123"}
});
CreateResult creationResult = api.Create("defect", defect);
And now the defect is able to be posted to Rally, but not have value of CustWebLink. While investigating i see the CustWebLink field was ignored in serialization of posting request.
Rally.RestApi Post Response: {"CreateResult": {"_rallyAPIMajor": "1", "_rallyAPIMinor": "29", "Errors": [], "Warnings": ["Ignored JSON element defect.CustWebLink during processing of this request."],.....}
This is relatively straightforward, you just need to create separate DynamicJsonObject for the Weblink, and assign values to it for the LinkID and DisplayString attributes. Then, assign the Weblink object as a Field for the Defect. Here’s a simple example: