How to automatically add project key and issue type to Customer Request Type custom field ? Edited

Hello,

 


I need a bit of help please.

 


I have discovered that for JIRA (6.4.8) + Servicedesk (2.5), in order to display an issue on the ServiceDesk customer portal, one of the (many) requirements is that the 'Customer Request Type' custom field is set to a string that looks like "<project key>/<Servicedesk portal issue type>".

 


i have been trying to create a ScriptRunner EscalationService on the "Issue Created"  event, based on the https://community.atlassian.com/t5/JIRA-Core-questions/How-to-put-jira-issue-key-into-a-jira-custom-field-automatically/qaq-p/176137 article, but it does not work.

 


I also attempted to go the workflow way (https://community.atlassian.com/t5/JIRA-questions/Script-Runner-Post-function-to-set-fixVersion-and-affectsVersion/qaq-p/395637) but i can't get it to work due to the error below:

 


2017-04-06 11:38:35,410 http-bio-8080-exec-1 WARN g.moscalu 698x4655x1 1ybrlfj 10.47.9.15 /secure/QuickCreateIssue.jspa [internal.customfields.origin.VpOriginManagerImpl] Origin portal not found for 'DEMO/incident'.
 


Config info: we have one project per customer and a servicedesk activated per each external project (we have a couple of internal projects). All our projects and ServiceDesks are configured the same (SQL to create the portals, views, mappings, etc - obtained by reverse engineering what the portal does).

 


So my need is to add the possibility that new tickets that are external get displayed on the portals, as if they would have been created from the portal. The old ones - we'll update them via bulk changes, but we can't do this every single day.

 

Our agents use the JIRA interface, while customers are being moved on the portal, so I kind of absolutely need to get this working.

 

Available addons: 

- ScriptRunner

- JIRA Misc Workflow extensions

- JIRA Suite Utilities


Thanks in advance,

Gabriel

 

[LE]: sample data:

SELECT id FROM project where pkey="DEMO";


ID
11701

issues:

SELECT id,issuenum,issuetype,reporter,summary FROM jiraissue where project=11701 order by created desc limit 5


ID issuenum issuetype REPORTER SUMMARY
40507 57 11100 g.moscalu Internal attachments for DEMO-56
40506 56 10306 g.moscalu new test
40504 54 10306 g.moscalu test #3
40505 55 11100 g.moscalu Internal attachments for DEMO-54
40502 52 10306 g.moscalu test 2

 and the portal mapping:

SELECT * FROM customfieldvalue where customfield=10000 and issue in (40502,40504,40505,40506,40507) order by id desc limit 5

ID ISSUE CUSTOMFIELD PARENTKEY STRINGVALUE NUMBERVALUE TEXTVALUE DATEVALUE VALUETYPE
639642 40504 10000 null demo/incident null null null null

 

The current workflow post function is the next one:

import com.atlassian.jira.component.ComponentAccessor 

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def project = issue.getProjectObject()

def userCf = customFieldManager.getCustomFieldObjectByName("Customer Request Type")
issue.setCustomFieldValue(userCf, project.getKey().toLowerCase() + "/incident") 

failing with:

2017-04-06 17:01:55,611 http-bio-8080-exec-3 WARN g.moscalu 1021x6970x1 88np8g 10.47.9.15 /secure/QuickCreateIssue.jspa [internal.customfields.origin.VpOriginManagerImpl] Origin portal not found for 'wirefr/incident'.

while in DB, I have the following issues that should be accesible by the customers (external tickets):


pkey pname STRINGVALUE CRs IRs SRs INCs INTs NbIssues
WIREFR WIREFRANCE null 27 53 36 864 107 1094
WIREFR WIREFRANCE WIREFR/incident 0 0 0 1 0 1

 

3 answers

1 accepted

This widget could not be displayed.

the final solution was to create an automation rule that handles tickets as they get created or updated and sets the proper request type... i even went further and the rule is created via REST API  calls :) (download servicedesk definitions, then look a couple of things up in the JSON with "jq" tool, and build the proper JSON to create the rule - all our sdesk projects are 99,99% similar)

 

of course existing issues had to be updated via bulk updates per project & issue type....

This widget could not be displayed.

for some reason, on some tickets the project code is in caps, on other project tickets, the project key is lowercase... i cannot understand why, so i can set a proper workflow code

This widget could not be displayed.

Hi Gabriel,

I've the same issue with "request type". I've found also not solution until yet. I tried REST-API and .NET-SDK. I create also a support ticket at jira-support, but got basically the answer "we provide REST-API / .NET, but we do not support creating issues from external systems."

I know: not the answer you are looking for.

BR, Andre

Thanks Andre,

 

I just wonder if anyone can put some light on how the project key on servicedesk portal get on upper or lower case... or how shall I do to make it the same for all our 200+ customer projects, to be able then to force this via the workflow post-function...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

31 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you