Problem Creating Subtask

132 views
Skip to first unread message

Igal N

unread,
Jan 13, 2011, 12:06:58 AM1/13/11
to jira-extended-webservice
I am getting an error creating a Sub-task:

com.atlassian.jira.rpc.exception.RemoteValidationException:
{issuetype=The issue type selected is invalid.} : []

Here is the details of the RemoteIssue object:


{CitiAI.Jira.Lib.JiraSvc.RemoteIssue}
affectsVersions: Nothing
affectsVersionsField: Nothing
assignee: Nothing
assigneeField: Nothing
attachmentNames: Nothing
attachmentNamesField: Nothing
components: {Length=0}
componentsField: {Length=0}
created: Nothing
createdField: Nothing
customFieldValues: {Length=2}
customFieldValuesField: {Length=2}
description: Nothing
descriptionField: Nothing
duedate: Nothing
duedateField: Nothing
environment: Nothing
environmentField: Nothing
fixVersions: {Length=0}
fixVersionsField: {Length=0}
id: Nothing
idField: Nothing
key: Nothing
keyField: Nothing
priority: "3"
priorityField: "3"
project: "MIMO"
projectField: "MIMO"
reporter: Nothing
reporterField: Nothing
resolution: Nothing
resolutionField: Nothing
status: Nothing
statusField: Nothing
summary: "Deploy MOM"
summaryField: "Deploy MOM"
type: "7"
typeField: "7"
updated: Nothing
updatedField: Nothing
votes: Nothing
votesField: Nothing


JiraServiceClient.getSubTaskIssueTypes(Token) returns:

{CitiAI.Jira.Lib.JiraSvc.RemoteIssueType}
description: "The sub-task of the issue"
descriptionField: "The sub-task of the issue"
icon: "https://citigroupai.citigroup.net:7702/jira/images/icons/
subtask.png"
iconField: "https://citigroupai.citigroup.net:7702/jira/images/
icons/subtask.png"
id: "7"
idField: "7"
name: "Sub-task"
nameField: "Sub-task"
subTask: True
subTaskField: True

Ath

unread,
Jan 13, 2011, 6:08:36 PM1/13/11
to jira-extended-webservice
The trick with SubTasks, is to first create a 'normal' issue, using a
standard issueType, and then use createSubTaskLink to 'convert' that
into a SubTask, linked to a main Issue.
My C# call looks like this: (in Java it will be the same I guess)
jir.createSubtaskLink(token, mainIssueId, subIssueId, issueTypeId);
where the issueTypeId (of type long) would be your value 7

HTH
Ath

Igal N

unread,
Jan 14, 2011, 1:34:03 PM1/14/11
to jira-extended-webservice
Awesome... Let me give it a try and I will post the result. Thanks so
much for your help.

Igal N

unread,
Jan 14, 2011, 3:30:09 PM1/14/11
to jira-extended-webservice
Looks like I am now able to create the issue and then also link it and
convert it to the Sub-task type (7).

At the time of creation, I am sending a bunch of custom fields and
their values, but none of them seem to be associated with the issue. I
have checked in the DB as well. I don't see any entries in the
CUSTOMFIELDVALUE table for the sub-task issue.

Any help would be appreciated...

Thanks again for your time.

Igal Nassi




On Jan 13, 6:08 pm, Ath <tonhu2...@gmail.com> wrote:

Ath

unread,
Jan 14, 2011, 4:08:49 PM1/14/11
to jira-extended-webservice
Hm, That is, just like a lot of Jira stuff, a little tricky too :-)
Every type of field has it's own way of getting the values provided,
some list-type fields need to get a list of values provided, and
string-type custom fields just want the string value in a single-
dimension array: (Some snippets from my C# app)
// string field:
retVal.id = remoteFieldId;
retVal.values = new string[] { fieldvalue };
// Multiple Checkbox/Multiple Select: ('vall' is the list of values
selected, matching the possible fieldvalues exactly!)
retVal.id = remoteFieldId;
if (vall.Count > 0)
{
retVal.values = vall.ToArray();
}
else
{
retVal.values = new string[] { };
}
// Components/Versions: The ID's should be provided as values
string[] comps = new string[component.Count];
for (int v = 0; v < component.Count; v++)
{
comps[v] = component[v].id;
}
retVal.id = remoteFieldId;
retVal.values = comps;
// Priorities/Issuetypes/Resolutions/Groups: (Single-select fields,
only 1 ID should be provided)
retVal.id = remoteFieldId;
retVal.values = new string[] { prioId };

retVal is a single RemoteField that is added to the CustomFields array
for each CustomField.
- Be sure to only add each fieldId once, or replace/append extra
values to the existing CustomField in the array.
- Do not try to add a field that's not available at the Create Issue
screen or you don't have accessrights to.

/Ath

Igal N

unread,
Jan 14, 2011, 5:09:39 PM1/14/11
to jira-extended-webservice
Hi Ath,

Thanks for explaining the way JIRA web service is supposed to be used.
I am already doing all the things you said. I am able to create any
kind of issue types with custom or standard JIRA fields.

The problems happen when I create a random issue type ("Issue" to be
precise) with the fields of the Sub-task issue. It looks like JIRA is
ignoring any custom fields that it is not associated to "Issue".

I think one solution would be to create a Parent issue type and assign
that the same fields as the "Sub-task" issue type. Instead of using
"Issue" to create the sub task, I should use this new type.

Let me give that a try and I will let you know.

Really appreciate your help.

Thanks,
Igal
Reply all
Reply to author
Forward
0 new messages