SIL - value of custom field of other issue

Hello.

I'm struggling with a small but annoying problem. How can I get a value of customfield of other issue?

I'm trying to compare creation dates of linked issues, yet structure like otherissuekey.customfield_00000 is not working properly.

I will appreciate any help, especially that somehow documentation of Kepler Rominfo plugins seems to be down at the moment.

2 answers

1 accepted

Hi,

You can get value like this: #{%otherissuekey%.customfield_00000}

That is correct.

Just to add a bit to the explanation, there are 2 ways in which you can accomplish this.

1. using the issue key directly e.g. TEST-1.customfield_00000

2. using substitution for the issue key:

string otherissuekey = "TEST-1"; // could be anything that sets a valid issue key to this variable

%otherissuekey%.customfield_00000;

Note: the use of #{} is only needed if you are using the custom field name and it contains whitespaces, otherwise it is optional.

If you're still having trouble with the syntax, please give a script snippet that show exactly how you're using it.

Thanks guys, that's a really detailed description that helped me to immediately solve my problem :)

Unfortunately I bumped on another one. Now when I use %my_variable_containing_key%.created I get following error in logs:

"Caused by: com.keplerrominfo.jira.commons.sil.SILInfoException: [SIL Error on line: 8, column: 38] Variable >>.created<< is not a custom field."

Do I have to use different construction when I try to get value of system field?

Here is my whole SIL code:

string[] my_linked_issues_array = linkedIssues(parent);
string my_loop_index;
string my_current_issue_key = key;
string my_linked_issue_key;

for(my_loop_index in my_linked_issues_array){
        my_linked_issue_key = my_linked_issues_array[my_loop_index];
	if (%my_linked_issue_key%.created &gt;= #{%my_current_issue_key%.customfield_10900}){
		linkIssue(key, my_loop_index, "Relates");
        }
}

The for each construction iterates through values not indexes, so the "my_linked_issue_key" will get the value of array["some key"] which is null.

for( x in array) {

// x is element, not index

}

Instead, try this:

for(my_linked_issue_key in my_linked_issues_array){
    if (%my_linked_issue_key%.created >= #{%my_current_issue_key%.customfield_10900}){
        linkIssue(key, my_linked_issue_key, "Relates");
} }

Hi,

The documentation should be visible online, our providers are having problems with the heat outside :)- It was a brief interruption of about 10 minutes. There are something like 313 K (40C/100F) outside.

Thanks for the info :)

No worries, few days ago we have had similiar temperatures here, so I know what you feel ;) Be cool! :D

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

702 views 6 13
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you