It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

272 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you