【问题标题】:How to populate default values of fields while creating issues in JIRA using jira-plugin?如何在使用 jira-plugin 在 JIRA 中创建问题时填充字段的默认值?
【发布时间】:2019-04-02 13:12:14
【问题描述】:

我正在开发 jira-plugin 以在 JIRA 中创建问题。我正在使用方法 - create(user,createValidationResult) 来创建问题。

我需要在创建时提供必填字段的值。

我想在创建时提供字段的默认值。 (默认值是在 JIRA 中创建这些时配置的值)

我找到了以下方法

  1. 方法populateDefaults

  2. 方法getDefaultValue

但这两种方法都需要Issue- 参数,该参数尚未创建,因为我需要在设置默认值后创建问题

请告诉我如何设置这些字段的值。这些字段是使用类IssueInputParameters中的addCustomFieldValue方法添加的

【问题讨论】:

    标签: java jira jira-rest-api jira-plugin atlassian-plugin-sdk


    【解决方案1】:

    我自己找到了解决方案:(效果很好)

    使用以下方法:

        IssueInputParameters issueInputParameters = 
                                        issueService.newIssueInputParameters();
    
        issueInputParameters.setApplyDefaultValuesWhenParameterNotProvided(true);
    
        IssueService.CreateValidationResult createValidationResult = 
                             issueService.validateCreate(user, issueInputParameters);
    
        issueService.create(user,createValidationResult);
    

    注意:在上面的代码中,'issueService'是IssueService的一个对象。

    【讨论】:

      猜你喜欢
      • 2013-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      相关资源
      最近更新 更多