SIL - retrieve information for fields from another project

Hi Guys,

I'm trying to use Kepler Custom Fields and the script below but get an error on the create screen and no options to select from on the edit screen.

Error:Script is not running in the context of an issue.Cannot get value for field customfield_13608 at com.keplerrominfo.jira.plugins.keplercf-pro:sil-options-multi-select-cf/com/keplerrominfo/jira/plugins/keplercf/pro/optionscf/selectcf-edit.vm

Setup

Project A:

Field A = Value 1,2,3

Project B :

Field A = Value 1,2,3

Field B = Value 1,2,3

What i want to achieve is , when i type in value 1 on field A on the create / edit screen of Project A, i want it to match the same value of field A on Project B and return field B's values .

The script im using is linked to an 'Info' custom field using a multiline text field (customfield_13606).

Consider field A on project A as customfield_13608

Script

KPOption[] selectedValues = customfield_13608;
customfield_13606 = "";
string [] allIssues = selectIssues("project=SERVICE and status=production order by summary");
// string[] selectedKeys;
string headingsText = "|| Type || Summary || Key || Production Group || Platform ||";
string contentText;
for (KPOption v in selectedValues) {
for (string iss in allIssues) {
if (iss.summary == v.value) {
// selectedKeys = addElement(selectedKeys, iss.key);
string[] fields = getIssueFields(iss.key);

string[] fieldAItems = fields["customfield_10314"]; // because the Production Group field is a multiselection

string[] fieldBItems = fields["customfield_10286"]; // because the Platformp field is a multiselection

contentText += "\n| " + iss.type +" | " + iss.summary + " | " + iss.key
+ " | " + fieldAItems + " | " + fieldBItems + " |";
}
}
}
if (isNotNull(contentText)) {
customfield_13606 = headingsText + contentText;
}

 

1 answer

I realised the error as it was my fault.

The script was matching on custom field 13608-

KPOption[] selectedValues = customfield_13608;

However, the values in that field were never going to match what i was fetching from the other project as that field was producing a different result set! Made sure that field had the same as the keys in the destination project and that resolved it.

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
Posted Tuesday in Uncategorized

Friday fun: how many celebrates Midsummer holiday or is this a Swedish tradition only?

Any other country that celebrates Midsummer holiday (this friday 22 June)?  

44 views 3 1
Join discussion

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