set customfield on transition screen activiation

hello there - 

I was wondering whether a customfield can have its value set, once the user presses the appropriate transition button, which is linked to a transition screen. 

I would like to pre-set a value once the screen is activated.
to elaborate:

After a user creates an issue, then several choices, in form of transition buttons are on the screen, say then the user presses the "Standard" button, a transition screen pops up and I want then a customfield called "Change Category" to be set to "Standard". I am using this in conjunction with the data gathered on that screen and I do not need it "AFTER" the transition button is pressed.

 Hope this makes sense

1 answer

This widget could not be displayed.

In our plugin we did it by two ugly enough methods:

  1. extend Custom Field class, and overrride methods to get value to view

    public class MyCustomFiled extends AbstractSingleFieldType<DomainClass> {
        @Override
        protected DomainClass getObjectFromDbValue(@Nonnull Object o)
        public DomainClass getValueFromIssue(CustomField field, Issue issue) {...}
    }
  2. Use JIRA.Events.NEW_CONTENT_ADDED event

    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function () {
        var issueTypeFields = document.getElementsByName('issuetype');
        if (issueTypeFields) {
        var issueTypeField = issueTypeFields[issueTypeFields.length - 1];
        try {
            if (issueTypeField instanceof HTMLSelectElement) {
                if (issueTypeField.options.length) {
                   ...
                }
            }
        } catch (e) {
        }
    }

The thing is what our custom fields default values are depend on another custom fields values...

what is your plugin? do you need to update the custom class every time you update Jira? the snippets here dont make quite sense to me, sorry, I would not know where to take this from here

It is internal plugin, we do not publish it. First one is creation special custom field type. Second one is jQuery hook on page load.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

534 views 23 15
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you