@Override public GenericValue createIssue(final ApplicationUser remoteUser, final Issue issue) throws CreateException { validateCreateIssueTextFieldsLength(issue); try { final Map<String, Object> fields = new HashMap<>(); fields.put(ISSUE_MAP_KEY, issue); final MutableIssue originalIssueGV = getIssueObject(issue.getId()); fields.put(WorkflowFunctionUtils.ORIGINAL_ISSUE_KEY, originalIssueGV); final GenericValue issueGV = workflowManager.createIssue(remoteUser != null ? remoteUser.getName() : null, fields); return issueGV; } catch (final WorkflowException workflowException) { final Throwable cause = workflowException.getCause(); if (cause instanceof InvalidInputException) { throw new CreateException("Error occurred while creating issue through workflow: " + cause.getMessage(), (InvalidInputException) cause); } throw new CreateException(workflowException); } }
final GenericValue issue = workflowManager.createIssue(remoteUserName, fields); return issue;