Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Behaviour script to run JQL query with setConfigParam() Edited

Hello everybody,

 

I have an issue picker field in my request form and I would like to run a JQL filter using the reporter chosen in the "Raise this request on behalf of" field. 

 

To do that, I did try to use a behaviour script , looks like this :

def issuePicker = getFieldByName("Order")

issuePicker.setConfigParam('currentJql', 'project = "projectA" and issuetype = "Service Request" and status = "In Progress" and reporter = ????????? )

 

What do I have to put instead of ???????? to get the reporter name selected in the "Raise this request on behalf of" field ?

 

Thanks a lot for your help.

2 answers

1 accepted

0 votes
Answer accepted

@Peter-Dave Sheehan  Thanks for the answer!

I'm now able to gather the reporter name in the reporterName variable (I did verify that in the logs).

But now, how do I have to put this variable in the JQL query ? (reporter = reporterName does'nt work)

 

def reporterFld = getFIeldById('reporter')
def reporterName = reporterFld.value

def issuePicker = getFieldByName("Order")
issuePicker.setConfigParam('currentJql', 'project = "projectA" and issuetype = "Service Request" and status = "In Progress" and reporter = ?????????')
 

   

I'd recommend you become familiar with string management methods in groovy. Here is a good place to start: https://groovy-lang.org/syntax.html#all-strings

But basically, there are many ways to define strings:

  • 'single quoted string'
  • "double-quote string"
  • '''triple quoted string'''
  • """triple double-quoted string"""
  • /slashy string/
  • $/dollar slashy string/$

Each has they limitations and advantages. The biggest one is the single-quoted strings can't have variable injections. And when you want to use double-quotes inside the string, I often prefer to switch to slashy string so I don't have to escape the double-quotes.

Here is what your JQL would look like:

issuePicker.setConfigParam('currentJql', /project = "projectA" and issuetype = "Service Request" and status = "In Progress" and reporter = $reporterName/) 
0 votes

The "raise issue on behalf of" in the customer portal is really the same as the reporter field in regular jira.

So...

def reporterFld = getFIeldById('reporter')
def reporterName = reporterFld.value

 ... will get you the username of the reporter and you can use that in your jql.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

ThinkTilt is joining the Atlassian Family!

This morning, Atlassian announced the acquisition of ThinkTilt , the maker of ProForma, a no-code/low code form builder with 700+ customers worldwide. ThinkTilt helps IT empower any team in their or...

339 views 19 20
Read article

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