how can i call the field Request type

Hugo André Dias Maurício May 21, 2015

Good Morning,
My name is Hugo Maurício, i work in the company Deloitte.
I have an problem with the custom fields in Service Desk, i want to make a rule using the addon ScriptRunner but when i put in the code, 
"cfValues['Customer Request Type '] == 'Marcação de videoconferência'"

It do nothing. What i want is that the email only bee sent when the costumer selecet the request type "Marcação de videoconferência",what is the way to call that block field as it is written on the top?

Best Regards,
Hugo Maurício

3 answers

1 vote
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2015

Is Customer Request Type a select list? If so you need

cfValues['Customer Request Type ']?.value == 'Marcação de videoconferência


1 vote
Rodrigo Rosa
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 21, 2015

Hi Hugo,

 

I believe you can find an answer to your question here: Set JIRA Service Desk Custom Field in groovy

 

0 votes
Yves Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2018

With recent Service Desk version, "Customer Request Type" value consists in a `project/UUID` string which can be found in database tables AO_54307E_VIEWPORTFORM (key) in relation with AO_54307E_VIEWPORT (key).

Refer to SQL query available at https://community.atlassian.com/t5/Jira-Service-Desk-questions/Re-set-customer-request-type-with-script-runner/qaq-p/120737/comment-id/1213#M1213

 

SELECT concat(lower(p.pkey),'/',vform.key) as value FROM jiraissue i , project p, issuetype t ,  AO_54307E_VIEWPORT vport, AO_54307E_VIEWPORTFORM vform WHERE p.id = i.project  AND i.issuetype = t.id AND i.project = vport.project_id AND vport.id = vform.viewport_id AND vform.issue_type_id = t.id AND i.id = 'PROJECT-123';
Mauricio Gonzalez March 5, 2018

So if I have a request type, of type "After Sales"

My condition will by like this?

cfValues['Customer Request Type']?.value == "projectKey/After Sales"

Yves Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2018

You have to use SQL query above to find out Customer Request Type <<UUID>>.

Then condition has to test for value "projectkey/ed3df54d-5f13-4b7b-8010-07aca15d68c4" (an example from my setup)

Helder Martins November 16, 2018

How do you get the value for the different Request Types (UUIDs)?

Yves Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2018

With the mentioned "SELECT" SQL statement from my answer, to be executed in JIRA database itself directly.

Helder Martins November 19, 2018

I use Jira cloud version, so I have no access to SQL. :(

Christian Wiemer January 10, 2019

Hi Helder,

you can extract the UUIDS via scriptrunner script console. If you have an issue with the selected option:

 

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.customfields.CustomFieldType

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()

def issueObject = issueManager.getIssueObject("issuekey")

String customFieldId = "customfield_10009"
CustomField customField = customFieldManager.getCustomFieldObject(customFieldId)
String fieldValue = issueObject.getCustomFieldValue(customField)
return "KEY: "+fieldValue

Like Cat W likes this
Don Lewis March 1, 2019

Does the above query work for anyone?  This is the error I get when I run it:

ERROR: relation "ao_54307e_viewport" does not exist

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events