Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,583
Community Members
 
Community Events
168
Community Groups

Set an Insight Custom Field to match Parent in the "Create" screen

Edited

I have an Insight Custom Field called System.  It is on my parent Issue Type (called System Release) and on a sub-task (called Application Release).

When the user selects new sub-task on the parent issue, I want the System value for Application Release to be already filled in (I plan to make it so the user can't change it).

At first I planned to use ScriptRunner for this.  But ScriptRunner and Insight don't work together.   (I do the "setFormValue" call and the logs report it is set, but it is not actually set.  I have since found a host of posts and feature requests around this.  But right now, they don't seem to work together.)

So, with ScriptRunner out, I am left wondering if I have any other options.  Is there any way to pre-select an Insight value in a create screen (based off its parent)?

NOTE: To be very clear, I am NOT looking for a way to set the value after the post (save) happens.  There are several ways to do that.  I want it set as the "Create Subtask" screen is shown.

2 answers

1 accepted

0 votes
Answer accepted

Hi Stephen,

I'm sorry to here that ScriptRunner can't handle Insight fields yet but I'm sure that they are focus on this since the more Insight grows, the more users will need to do this kind or similar configurations.

Anyways, to your problem. There is not an out of the box configuration for this in Insight. And as you said, doing this with postfunction is a no brainer.

However, I have fixed a javascript for you to use, just to get started and you will need to fetch the key from the parent via the REST-API or the way you prefer and limit the scope when this should be executed.

 

<script>

function
populateInsightField(customFieldKey, objectKeys) {

// Unregister the current Insight field
AJS.$('[id^=' + customFieldKey + '-]').remove();

// Initiate the form with the objectKeys
var cf = AJS.$('#' + customFieldKey).attr('data-keys', objectKeys);

// Init the Insight field with a preselect object
RLABS.CustomField.setupCustomField(cf);
}

// Write a script to determine the object key from parent
var objectKeys = 'ABC-123';

// The custom field you want to populate
var customFieldKey = 'customfield_XXXXX';

// Populate the Insight custom field (same for all types)
populateInsightField(customFieldKey, objectKeys);

</script>

There are ways to inject javascript to Jira, someone better then others, I would prefer a small custom plugin for it but you can try this out in the Announcement Banner. Let me know if this helps and if you have any further questions.

Cheers //Mathias

can u share the script runner code plz

same issue here...

Any convenient solutions? ideas?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Apps for Confluence you won't want to miss: RSVP for September's Appy Hours

Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...

118 views 0 9
Read article

Atlassian Community Events