The need to create Requests in different Service Desks has grown over the last few months. I used to follow these steps:
1. Add a script to a workflow post-function that creates the ticket in the other service desk (using "issueService")
2. Add another script to the workflow on the other Service Desk to add a "Customer Request Type" (using issue.setCustomFieldValue([Customer Request Type Field], [Customer Request Type Id]), where the Id looked something like this: key/kjjfsd03kjs03jklj1293ckjf)
The "problem" is that I don't want to do step 2 for EVERY SINGLE request that I create in a different Service Desk. I would rather include the "Customer Request Type" in step 1. This will eliminate the need to always build in "defaults" or logic that adds the correct Customer Request Type.
Here is my attempt at including the "Customer Request Type" with the issueInputParameters (removed code that probably isn't relevant):
def IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.addCustomFieldValue(customer_request_type.getId(), customer_request_type_key.toString())
def validationResult = issueService.validateCreate(loggedInUser, issueInputParameters)
def issueResult = issueService.create(loggedInUser, validationResult)
I have tried a few different customer_request_type_key values:
- key/kjjfsd03kjs03jklj1293ckjf
- 117 (the ID of the request)
- "Office Move" (the name of the request which I didn't expect to work but tried anyways)
The first one works every single time I use it with issue.setCustomFieldValue(), which almost always occurs on the create transition.
I have also attempted to do a issueService.validateUpdate() and issueService.update(). But I get the same result...still an empty Customer Request Type. I suspect the problem comes from IssueInputParameters. I couldn't find any other method besides addCustomFieldValue that made sense to use.
I also attempted to just do issueResult.getIssue().setCustomFieldValue() in the same script as above, but it never is successful.
Any help/tips would be greatly appreciated.