Info | ||
---|---|---|
| ||
This routine is available starting with katl-commons 1.0. |
Syntax
createIssue(projectKey, parentIssueKey, issueType, issueSummary)
or
createIssue(projectKey, parentIssueKey, issueType, summary, priority, description, components, due date, estimate, security_level, custom_fields_mappings)
...
Button handy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Table plus | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
...
Cloud Syntax
createIssue(projectKey, parentIssueKey, issueType, summary)
or
createIssue(projectKey, parentIssueKey, issueType, summary, priority, description, components, estimate, security_level, field_mappings)
Info |
---|
To avoid conflicts regarding the custom field names, please use the custom field id instead of the name in the field_mappings. For some of the fields (eg: the fields provided by Jira Software, the set by name won't work at all). |
Description
...
|
Description
Excerpt | ||
---|---|---|
| ||
Creates an issue based on the provided arguments. |
Creates an issue based on the provided arguments.
Parameters
Table plus | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
Note |
---|
Parameter is missing in the cloud version. |
|
...
|
...
|
...
|
...
|
The more complex custom fields will be able to be mapped using the object JFieldValue.
Return type
...
Return Type
String
The key of the created issue
...
...
Examples
Example 1
Code Block |
---|
string issue_priority;//Possible values: "Major", "Critical" etc.
string issue_description;
string[] issue_components;
string issue_security_level;
string[] custom_fields_mapping;
issue_priority = "Critical";
issue_description = "Description of the issue";
issue_components = components; //an array containing all the components of the current project
issue_security_level = "Administrator";
custom_fields_mapping = "STDUP|fmanaila|STDGP|jira-users";
string k = createIssue(
"PROJECT",
"PRJ-300",
"Sub-task",
"Summary of the sub task" ,
issue_priority,
issue_description,
issue_components,
currentDate() + "30d",
"1h 30m",
issue_security_level,
custom_fields_mapping
);
print ("On the project " + project + ", issue " + k + "is created."); |
...
Result: On the project PROJECT, issue PRJ-300 is created. Issue details are as declared above.
Example 2
Code Block |
---|
string issue_priority;//Possible values: "Major", "Critical" etc.
string issue_description;
string issue_security_level;
issue_priority = "Critical";
issue_description = "Description of the issue";
issue_security_level = "Administrator";
string k = createIssue(
"PROJECT",
"", // passing in empty to create a regular issue rather than subtask
"Bug",
"Summary of the sub task" ,
issue_priority,
issue_description,
{}, // no components
currentDate() + "30d",
"1h 30m",
issue_security_level,
{} // and no custom field mappings
);
print ("On the project " + project + ", issue " + k + "is created."); |
...
Will create a Bug with no components and no special custom field values (all defaults).
Example 3
Code Block |
---|
string issue_priority;//Possible values: "Major", "Critical" etc. string issue_description; string[] issue_components; string issue_security_level; string[] |
...
custom_fields_mapping; issue_priority = "Critical"; issue_description = "Description of the issue"; issue_components = components; //an array containing all the components of the current project issue_security_level = " |
...
Administrator"; |
...
custom_fields_mapping = " |
...
STDUP|fmanaila|STDGP|jira-users"; string k = createIssue( "PROJECT", "PRJ-300", |
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
"Sub-task", "Summary of the sub task" , issue_priority, |
...
issue_description, |
...
issue_components, currentDate() + "30d", "1h 30m", issue_security_level, |
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
Will create an Improvement with no components and the assignee set for user with the username "someUserName".
Example 4 (Cloud only)
...
custom_fields_mapping |
...
) |
...
;
print ("On the project " + project + ", issue " + k + "is created."); |
...
Will create an
...
Improvement with no components and the assignee set for user with the username "someUserName".
For more complex custom fields like the ones described here in the section Setting custom field data for other field types, for example CascadingSelectField that has a structure like
"customfield_10001": {"value": "green", "child": {"value":"blue"} }
or MultiUserPicker that has a structure like
"customfield_10009": [ {"name": "charlie" }, {"name": "bjones" }, {"name": "tdurden" }]
we have made an object JFieldValue that you can find in predefined structure types . With it we can define what we could not with just a string [].
Example 5 (Cloud only)
...
Example 4
Code Block |
---|
JFieldValue[] cfMappings; JFieldValue cfValues; cfValues.fieldName = " |
...
my_multi_ |
...
field"; |
...
for(int i=0; i<3; ++i) {
string tempLabel = "my label " + i;
string tempVal = "my value " + i;
cfValues.values[i*2] = tempLabel;
cfValues.values[i*2 + 1] = tempVal;
}
cfMappings += cfValues;
createIssue("JSD", "", "Task", "summaryyy", "", "", "", "", "", "", cfMappings);
print ("On the project " + project + ", issue " + k + "is created."); |
Will create a Task, on the ‘JSD’ project, and will fill the ‘my_multi_field’ with 3 values (“my label 0”, “my label 1” and “my label 2”).
This is useful, for example if you have a field that allows multiple values to be selected (E.G. Power Custom Fields' - “PCF - Multi Select“.
Optionally, for Power Custom Fields, you can set the option’s value. If you don’t want the option’s value set, you can just use simple strings instead of the JFieldValue structure.
See also
Filter by label (Content by label) | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
...
|
...
|