Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

based on elements connect field value labels value should be assigned

Parsa Mounika May 4, 2023

Hi ,

There is one requirement from end user based on elements connect field value(EngSolutions_Mumbai_HLS), system labels field value should set. If labels have existing values new value should append to existing value. I am using below script, but it is not working as expected can someone help me on this. I am sharing the script also.

 

import com.onresolve.jira.groovy.user.FormField;
import com.atlassian.jira.issue.IssueFieldConstants
import groovy.json.JsonSlurper
 
FormField descriptionField = getFieldById(IssueFieldConstants.LABELS)
FormField elementsConnectField = getFieldById("customfield_14082")
String connectFieldValue= elementsConnectField.getFormValue()
def currentLabels = descriptionField.getFormValue()
def newLabels = ['noautoclose']
if(connectFieldValue){
    def jsonSlurper = new JsonSlurper()
    def json = jsonSlurper.parseText(connectFieldValue)
    def connectFieldKeys = json["EngSolutions_Mumbai_HLS"]
 
    if (connectFieldKeys[0].equals("EngSolutions_Mumbai_HLS")) {
        descriptionField.setFormValue(newLabels);
    }
}
Screenshot 2023-05-04 150931.png

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Simon Laffont
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 4, 2023

Hello @Parsa Mounika

I am part of the Elements Connect support team.

What you are asking should be possible. But to answer you, I need to know more about your Connect field configuration.

I invite you to raise a request on our support platform so that we can look at this together in private.

Thank you.

Kind regards,
Simon.

0 votes
Ken McClean
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 5, 2023

I was curious if you needed some kind of "commit" type statement to make the changes stick.  For example, if you're updating an Issue in Jira you need to use the IssueManager's UpdateIssueRequest method to actually commit the changes to the database.

Looks like that's not necessary in this case for the form object, but it was interesting to dig into. Hopefully this got solved on the vendor support platform.


https://docs.atlassian.com/software/jira/docs/api/7.3.2/com/atlassian/jira/issue/IssueManager.html#updateIssue-com.atlassian.jira.user.ApplicationUser-com.atlassian.jira.issue.MutableIssue-com.atlassian.jira.issue.UpdateIssueRequest-

TAGS
AUG Leaders

Atlassian Community Events