I have the following JIRA screen with TABS, and I would like to create an vISSUE on the "Resquestor Details tab via REST API."
Now I have the following code and I'm not sure where to specify the tab name.
public function createTestData($firstName, $surname, $userID, $email, $testPortfolio, $projectName,$projectID,
$newSystem, $newProduct, $requirementsFunction, $evinronment, $dueDate, $region,
$summary, $description)
{
if ($this->finduser($email) < 1)
{
$json = Array ( "fields" => Array (
"project" => Array
( "id" => 20207 ),
"summary" => "$summary",
"description"=>"$description",
"issuetype" => Array ( "name" => "Test Data" ),
"customfield_14421" => "$firstName",
"customfield_15026" =>"$lastName",
"customfield_14490" =>"$userID",
"customfield_14415" =>"$email",
"customfield_156681" =>Array ("value" => "$testPortfolio"),
"customfield_12103" =>"$projectName",
"customfield_14236" =>"$projectID",
"customfield_14430" =>"$newSystem",
"customfield_15672" =>"$newProduct",
"customfield_15673" =>Array ("value" => "$requirementsFunction"),
"customfield_15685" =>Array ( "value" => "$environment"),
"customfield_15700" =>"$region",
"reporter" =>Array ("name" => "API" )
)
);
}
return $json;
}
I had a look at the Documentation but I don't really get it or see it anywhere.
I get this error:
cannot be set. It is not on the appropriate screen, or unknown. for all fields But the fields are on the correct issue Type and permissions are also correct.
To create an issue, you will need to know certain key metadata, like the ID of the project that the issue will be created in, or the ID of the issue type. You can request the create metadata for all issue types across all projects by using the createmeta resource.
The Jira Software and Jira Service Management applications have REST APIs for their application-specific features, like sprints (Jira Software) or customer requests (Jira Service Management). If you haven't used the Jira REST APIs before, make sure you read the Atlassian REST API policy.
If you use the JIRA Rest API to create an issue, ie. POST /rest/api/2/issue, then you do not need to think about the tabs that are displayed when you view the issue within JIRA. You just have to set all the desired fields and custom fields in the json that you post to JIRA.
You did not list the exact content that you send to JIRA, so I'm not entirely sure which REST resource you use.
The error that you mentioned, indicates that you're trying to set a field that is not available on the "Create Screen" for your project. You can verify this with the GET /rest/api/2/issue/createmeta resource. Probably its output does not list all the fields that you try to set.
To correct this, you have to verify the screen scheme that your project uses and make sure that the "Create Screen" associated with the scheme lists the necessary fields. The relevant JIRA documentation is available here.
As a sidenote: the tabs that you see when you view an issue, are defined in the "View Issue" screen of the project's screen scheme.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With