Reputation: 155
I am working on jira-plugin to create issues in JIRA. I am using the method - create(user,createValidationResult) to create issue.
I need to give values of mandatory fields while creating.
I want to give the default values of fields while creating. (The default values are the ones which are configured during the creation of these in JIRA)
I have found the below methods
method populateDefaults
method getDefaultValue
But both the methods require Issue- parameter which is not yet created as I need to create the issue after setting default values
Please let me know how to set the values for these fields. These fields are added using method addCustomFieldValue in the class IssueInputParameters
Upvotes: 0
Views: 442
Reputation: 155
I found the solution myself : (This works perfectly)
Use the below method :
IssueInputParameters issueInputParameters =
issueService.newIssueInputParameters();
issueInputParameters.setApplyDefaultValuesWhenParameterNotProvided(true);
IssueService.CreateValidationResult createValidationResult =
issueService.validateCreate(user, issueInputParameters);
issueService.create(user,createValidationResult);
Note : In the above code 'issueService' is an object of IssueService.
Upvotes: 1