Forums

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

Copying the result of a Proforma dropdown selection into a Jira field

Paul Hampton-Smith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 5, 2023

I have a ProForma single select dropdown that has its options (a list of people's names) loaded by an external data connection. The action is mandatory, so a single person's name is the result. 

I would like to link or copy that name into a Jira single line text field.

If I try simply to link the dropdown to a Jira single line text field, ProForma tries to force the question to be single line to match, which is the opposite of what I want.

If I try to link the dropdown to a Jira dropdown field, I get a message asking which do I want: the external connection link, or the custom field?

Maybe there's a JQL solution?

1 answer

1 accepted

0 votes
Answer accepted
Evgenii
Community Champion
July 5, 2023

Hi, @Paul Hampton-Smith 

I faced the same problem too and after studying documentation and long experiments there was no solution. You can use values from customfield in proforma field, or you can use proforma with external connection, but you can't link it to customfield, and it's impossible to link customfield of one type to proforma field with another type.

I solved this problem with scriptrunner and groovy script (in postfunction), which takes values from proforma and adds it to customfield.

Paul Hampton-Smith
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 5, 2023

Thank's for replying @Evgeniy. I am reluctant to introduce groovy script, but maybe I'll have to.

Like Evgenii likes this
Evgenii
Community Champion
July 5, 2023

In case, if you'll decide to use script :)

/*
* Created 2023.
* @author Evgeniy Isaenkov
* @github https://github.com/Udjin79/SRUtils
*/

import com.atlassian.jira.bc.issue.properties.IssuePropertyService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.entity.property.EntityProperty
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
import groovy.json.JsonSlurper

Map getProformaAnswers(Issue issue, Integer formId = 1) {
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssuePropertyService issuePropertyService = ComponentAccessor.getComponentOfType(IssuePropertyService)
List<EntityProperty> allProperties = issuePropertyService.getProperties(currentUser, issue.id)
Map parsedJson = [:]
for (def property : allProperties) {
if ((property.key == "proforma.forms.i${formId}") && property.value.contains('\"schemaVersion\":8')) {
JsonSlurper jsonSlurper = new JsonSlurper()
parsedJson = jsonSlurper.parseText(property.value) as Map
}
}
return parsedJson.state.answers
}

Map proFormaData = getProformaAnswers(issue)
Like Paul Hampton-Smith likes this

Suggest an answer

Log in or Sign up to answer