Hi all, I was wondering if anyone could assist a newb. I am trying to set up my service desk. Our model is to send linked issue from the service desk to team projects for them to action.
I have created a script using ‘Clones and issue, and links’ to achieve this. The issue I am having is that I would like the Customer Request Type to be visible on the standard project screen. Is there an easy way to do this? (I have tried enabling in screen schemes without success).
One option I was considering was to fill a custom field with the customer request type adding the script into ‘additional issue actions’ (within my current script listener) - but have got no idea what to write.
Any assistance would be greatly appreciated!
Hello,
What do you mean by standard project screen? When you clone an issue all fields of the issue are cloned. Do you want to say that the Custom Request Type is not cloned?
Hi Alexey, sorry, I am meaning from a service desk project to a software project. I cannot see the field ‘customer request type’ on the software project even if enabled within the screen scheme. Ta.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, that is right. There is no such field in a Software project. You would need to create a new field, which would represent the custom request type from the Service Desk project and set the field. If you set the field manually, then you do not need any plugins. But if you want to set the field automatically, you would need a plugin like Power Scripts, ScriptRunner or Automation for Jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thankfully we have both ScriptRunner and Automation for Jira. I have tried setting a custom field via automation for Jira, but as I am also using a 'Clones an issue, and links’ script - this seems to occur before the 'Automation for Jira' action and does not take the field across.
I was considering using the 'additional issue actions' within script runner. ie
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'MyCustomFieldType'}
issue.setCustomFieldValue(cf, 'my value')
But I can't find a value for 'my value' which points towards the customer request type. Any ideas of what I could include? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem about the Customer Request Type is that it is not a field :) The value is stored in the issue properties, that Is why you have to use the Service Desk Api to get it:
import com.atlassian.servicedesk.api.requesttype.RequestTypeService import com.atlassian.servicedesk.api.requesttype.RequestType import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.atlassian.servicedesk") @PluginModule RequestTypeService requestTypeService def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() RequestType getRequestType = requestTypeService.getRequestTypeForIssue(currentUser, issue).right().get() String requestTypeName = getRequestType.getName()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much Alexey for your continued help. I am now certain I am well out of my depth here and an idiot's guide is needed :) Are you please able to dumb it down for me? So let's say I create a field called "Lemons" in which I intend to copy the customer request type. How would I do this, and what would the script be / where would I put it?
Note: I currently have a script listener which Clones and links an item from the Service Desk to the software project using the following script (which I had written for me):
//cfValues['Customer Request Type'] == 'Yammer (DE)'
import com.atlassian.jira.component.ComponentAccessor
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Customer Request Type")
def requestType = issue.getCustomFieldValue(cf)
if(requestType.toString() == "de/f0449f4c-a359-4d60-b516-70034ff84321")
{return true}
Am I able to add to this, to the 'additional issue actions', or do I need to create a new script listener? What would the new script I needed to include?
Really really appreciate your assistance!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.