createIssue
Description
Creates an issue based on the provided arguments.
Parameters
Return Type
String
The key of the created issue
Examples
Example 1
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
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
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.");
Will create an Improvement with no components and the assignee set for user with the username "someUserName".
Example 4
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.