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

Script Runner Script Field and Custom Field Context

Phillip Saindon September 3, 2019

Hello,

    I recently  went through my custom fields that are driven by scripted fields through scriptrunner and added a context to reduce the load on our Jira instance.  Unfortunately this made all the fields no longer appear on jira tickets.

    How I added a context

  • On the custom field configuration screen I:
    • Added a new context that defined my project and issuetype I wanted the fields to appear on
    • Deleted the default context that Jira puts in when creating a custom field.

I have gone back to our test instance to fiddle around with "adding" my context in a different way, and instead of creating a net new context for the custom field and deleting the default one on the custom field, instead, I directly modify the default one to be what I want.  This works and the fields continue to show up on the issues that I expect, but unfortunately in our production instance I am not in a state where I can "bring back the default context and modify it" since I have already deleted the default contexts.

Some other debugging that I have done.

  • I have validated that my new context in the production instance looks exactly like the modification to the default context in our test instance, at least on what the UI shows me.
  • I validated that all of my screens, screen scheme, and issue type screen schemes are setup correctly to be able to display this field.
  • I have used the "where's my field" debugger on the tickets.  The error I get is on Field Value: "The field '<custom field name>' does not have value for issue <Project key>-<key> and will not be displayed on the view issue page. Set value for that field so that it shows up."  It doesn't seem to be running the script anymore...
  • We have reindexed jira in its entirety, and this does not make the field display again on the ticket.
  • I have gone through the atlassian docs on custom field context, and it doesn't seem there are any other options or schemes that I need to create or attach a context to to make it work.
  • I have "reverted" my new context to be exactly what Jira sets up by default (global context [projects and issuetypes], name, description) and the field still does not show up.

Is there something I'm missing here that is special about scripted fields or custom field contexts?  Since I know that changing the default context will make this work again, I can go the route of completely deleting each one of these scripted fields and custom fields and re-creating them, but I'm unsure if I'll be able to get the same name of the field back if I try to recreate the field after deleting.  Since multiple of our JQL filters that drive other widgets use this custom field name, it's important that the name stays the same, at least.  Also other integrations to these fields that list them as a parameter to show (such as displaying this field in a filter results macro) will probably delete that option from showing at the time I delete the field (and before I recreate it), meaning there will be maintenance across many place I don't even know about to readd this to the macro(s) - so I would rather not take this route if I can avoid it.

 

Any suggestions on how I can get out of this mess?

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Mike Rathwell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2019

@Phillip Saindon , it seems that when one changes the field configuration name, it borks out the script. I do hope you have all the scripts somewhere as the fix is to simply put them back in.

Note also that Jira does allow duplicate field names so you could use precisely the same name if you needed to (and is part of the dumpster fire I inherited that I am still cleaning out). However, when testing here, found that simply putting the script back in the existing fields solved the problem

Phillip Saindon September 3, 2019

Thanks to git, yes I have all my scripts saved off.  This is the issue, creating a brand new context does delete you embedded script (at least if you put it directly in the UI of jira, and not on a saved system file).

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 17, 2019

I'm late to the game here, sorry, but there are some quirks with scripted fields and contexts.  I've seen a bug (no idea if it was SR or Jira or a compound thing) where the searcher changed when you changed a scripted field context, which broke them in interesting ways. 

So I'd want to check searchers were correct, and then, second, which seemed to fix all the other problems I'd had, re-index everything (background, you don't need the full locking one)

TAGS
AUG Leaders

Atlassian Community Events