Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fails to obtain the value of customer request type - Script runner

Hi Everyone!

We need to obtain the value of the customer request type since, from this, some fields must be hidden on a screen within the workflow. Example, if I choose "Help It" show me a sub-category custom field, since there are several sub-category fields we need that based on the customer request type that is changed as well show the corresponding sub-category field.

The code attachment is entered as a behavior but when set to a field of type text the result is encrypted

 

pastedImage.png

2 answers

0 votes
Alexey Matveev
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.
July 4, 2018

Hello,

You should use the Service Desk Api to get the value of the Request Type. You can find an example here

https://community.atlassian.com/t5/Marketplace-Apps-questions/Scriptrunner-getting-the-Request-Type-value/qaq-p/462318

Hi 

 

We tried the solution putting the script as validator in a transition, but wanting to do it from a behavior does not work.

 

Regards.

How could we call the value of the field since  a behavior?

Alexey Matveev
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.
July 4, 2018

What are the error in the atlassian-jira.log?

0 votes

This is the code that runs 

 

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.option.Option
import com.atlassian.jira.issue.customfields.CustomFieldType

def TipoSolicitud = getFieldByName("Tipo de solicitud");

long idTipoSolicitud = 10001
CustomField cfTipoSolicitud = customFieldManager.getCustomFieldObject(idTipoSolicitud);
String solicitud = underlyingIssue.getCustomFieldValue(cfTipoSolicitud)

TipoSolicitud.setFormValue(solicitud)

Alexey Matveev
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.
July 4, 2018

Hello,

You should use the Service Desk Api to get the value of the Request Type. You can find an example here

https://community.atlassian.com/t5/Marketplace-Apps-questions/Scriptrunner-getting-the-Request-Type-value/qaq-p/462318

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events