SIL - value of custom field of other issue

Błażej O_
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.
August 13, 2013

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

4 votes
Answer accepted
Nadir MEZIANI
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.
August 13, 2013

Hi,

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

Florin Manaila
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.
August 13, 2013

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.

Błażej O_
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.
August 13, 2013

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");
        }
}

Florin Manaila
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.
August 13, 2013

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");
} }

1 vote
Radu Dumitriu
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.
August 13, 2013

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.

Błażej O_
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.
August 13, 2013

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