It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how can get the value of a multi value field and add some thing to it in script runner

hi all,

I am using scriptrunner to send sms, i have a multi value filed as following which can select multiple values:

Capture.JPG

for each value of the field 1 there is another multi value field as following:

Capture2.JPG

Capture3.JPG

Capture4.JPG

 

for example if c1 and c2 have been selected; and in c1, A1 and A3 selected; and in c2, B2 and B3 selected; I want to send the value of the selected fields as following in the "fields" part of SMS message:

c1:A1,A3-c2:B2,B3

 

how can i do this in following script:

import groovyx.net.http.RESTClient
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.*
import static groovyx.net.http.ContentType.*
import groovyx.net.http.ContentType
import org.apache.http.HttpRequest
import groovy.json.JsonBuilder
import org.apache.http.HttpRequestInterceptor
import org.apache.http.protocol.HttpContext
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue
import groovy.json.JsonSlurper

MutableIssue issue = issue as MutableIssue

def s1=(issue.summary)?.replaceAll(' ','%20')

def s4=(issue.description)?.replaceAll(' ','%20')

def bvField =ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Field 1")
def s2 = ((String)(issue.getCustomFieldValue(bvField)))?.replaceAll(' ','%20')



 

def http = new HTTPBuilder("...&message=subject:${s1}+fields:${s2}+description:${s4}")
http.request( groovyx.net.http.Method.POST) {
}

any advice will be so appreciated 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you