Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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.

1 answer

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

Suggest an answer

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

Why you should move agile planning to Lucidspark’s digital whiteboard

During my 17 years as a coach, mentor, and trainer of Agile teams, I’ve participated in hundreds of Agile planning meetings. The end result was a wall of backlog items annotated by an explosion of co...

102 views 0 5
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