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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

SIL: How to get values of custom fields defined in a list


We had a question in Moscow Atlassian User group on how to get the value of a custom field in SIL if the name of the field is defined in an array.

I think code will explain it better:

string [] keys = selectIssues("key = SCRUM-22");
string [] fields = {"my text field"};
for (string k in keys) {
    for (string field in fields) {

As you can see I get issues by a JQL query. Then I define an array of the names of fields which values I want to print out for selected issues. Then I iterate over all issues and inside this loop I iterate over all fields in the fields array and print out the value.

If I try to compile this code I will get an error:

Screenshot 2020-06-26 at 12.34.15.png

The error is for this line:


SIL tries to find a field with the name "field" (SIL does understand that "field" is a variable, it looks for a field with the name "field") and SIL can not find such field and throws an error.

If we change this line with this one:

runnerLog(k.#{my text field});

Then everything will compile correctly and we will get what we want. Does it mean that we can not define names of custom fields in an array, instead we should always provide implicit names? Imagine we have 50 fields to select. In this case our code will look awful.

The answer is there is a way to make it clean.

SIL has this symbol %. If you surround a variable with this symbol, then SIL will treat this variable as a variable. It is needed in ambiguous situations like ours.

Let's surround the field variable with the % symbol like this:


Here is the complete code:

string [] keys = selectIssues("key = SCRUM-22");
string [] fields = {"my text field"};
for (string k in keys) {
    for (string field in fields) {

Now this code compiles and works as expected.



Log in or Sign up to comment

Atlassian Community Events