我安装了Jira 6.4.5和Script Runner 3.1.4。我创建了一个后期功能"脚本后功能" 我有以下脚本:
// get Application User <br>
ApplicationUser currentUser = ComponentAccessor.userUtil.getUserByName("admin")
// get project <br>
Project project = ComponentAccessor.getProjectManager().getProjectObjByKey("TEST");
// get issuetype <br>
IssueType issueType = ComponentAccessor.getIssueTypeSchemeManager().getIssueTypesForProject(project).find{it.name=="Task"};
// get user field <br>
CustomField csUserField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("userField");
//setup Input parameters <br>
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = new IssueInputParametersImpl();
issueInputParameters.setProjectId(project.getId()).setIssueTypeId(issueType.getId()).setSummary("summary created from script").setDescription("description created from script");
issueInputParameters.addCustomFieldValue(csUserField.getId(), "uname1");
CreateValidationResult createValidationResult = issueService.validateCreate(currentUser, issueInputParameters);
if (createValidationResult.isValid()) {
IssueResult createResult = issueService.create( currentUser, createValidationResult);
}
执行脚本时没有错误并且创建了问题但是自定义字段&#34; userField&#34;没有我试图通过的价值。 我做错了什么?
答案 0 :(得分:2)
我发现了什么问题。我必须在调用issueService.validateCreate()之前添加以下行:
issueInputParameters.setSkipScreenCheck(真);