Add custom field data when creating a new issue using the webservice
I am creating a new issue using the webservice and I need to add data to my custom fields. I have not been able to find documentation or an example of how to do this. I have tried creating a "CustomFieldDataEN" object populating it with data and then passing it into my "IssueEN" object. When I try to do this I get a type conversion error. What is the process that I need to be using to do this. Below is the code that I am currently using:
IssueEN data = new IssueEN();
UserEN user;
bool result = false;
CustomFieldDataEN Cfield1 = new CustomFieldDataEN();
Cfield1.CustomFieldID = 1;
Cfield1.CustomFieldData = "Test";
IssueComponentEN[] iceComps = new IssueComponentEN[1];
iceComps[0] = new IssueComponentEN();
iceComps[0].ComponentID = 1;
data.Components = iceComps;
data.FixedInVersion = 0;
data.IssueLongDesc = "This is another test";
data.IssuePriority = 1;
data.IssueResolution = 1;
data.IssueStatus = 1;
data.IssueSummary = "This is another test";
data.IssueType = 1;
data.IssueSeverity = 1;
data.ReportedBy = 1;
data.RiskLevel = 1;
data.Visibility = 1;
data.VisibilityMemberType = GeminiConstant.SecurityMemberType.GlobalGroup;
data.IssueCustomFieldData[0] = Cfield1;
data.ProjectID = 1;
// Note that this might throw a security exception.
ServiceManager serviceManager = new ServiceManager("http://myserver/gemini/webservices");
result = serviceManager.SetAuthenticationTokenOnAllServices("username", "password");
user = serviceManager.AuthorisationServices.LogIn("username", "password");
data.IssueID = serviceManager.IssueServices.CreateIssue(data);
helmsb
· 1 |
|
Wednesday, January 21, 2009, 3:45:42 PM |