SIL - retrieve information for fields from another project

BBC Application Admin Team April 25, 2017

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

0 votes
BBC Application Admin Team April 26, 2017

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
TAGS
AUG Leaders

Atlassian Community Events