Accessing custom field values from Jira workflow transition screen

I’m working on a Jira workflow validator plugin and I’m stuck. I need to get the value of a custom issue field from the workflow transition screen. This screen pops up when you’re moving an issue through the workflow.

Here’s the tricky part: I can’t use customField.getValue(issue) because that gets the value from the issue itself, not from the transition screen. I need to grab the value that the user inputs during the transition.

Does anyone know how to access these field values within the validate method of the validator? I’ve looked through the Jira API docs but couldn’t find anything specific to this scenario.

Any help or pointers would be greatly appreciated. Thanks in advance!

hey tom, i’ve run into this before. you wanna use the TransitionContext object in your validate method. it’s got a getFieldValue() method that’ll grab what the user entered. somethin like:

transitionContext.getFieldValue(“customfield_12345”);

just swap in ur actual field ID. hope that helps!

I’ve faced a similar challenge in my Jira plugin development. The key is to use the TransitionContext object, which provides access to the field values entered during the transition.

In your validate method, you should have a parameter of type ValidationContext. This object contains a getTransitionContext() method. From there, you can access the field values like this:

TransitionContext transitionContext = validationContext.getTransitionContext();
Object fieldValue = transitionContext.getFieldValue(“customfield_10000”);

Replace “customfield_10000” with your actual custom field ID. This approach allows you to get the value entered on the transition screen, not the current issue value.

Remember to handle null cases, as the field might not always be present on the transition screen. Hope this helps solve your problem!

I’ve encountered this issue before while developing Jira plugins. The solution lies in utilizing the TransitionContext object within your validate method. Here’s how you can approach it:

In your validator’s validate method, you should have a ValidationContext parameter. This object contains a getTransitionContext() method, which provides access to the transition-specific data.

You can then use the getFieldValue() method to retrieve the value entered by the user during the transition:

TransitionContext context = validationContext.getTransitionContext();
Object fieldValue = context.getFieldValue(“customfield_XXXXX”);

Replace “customfield_XXXXX” with your actual custom field ID. This method will return the value from the transition screen, not the current issue value.

Remember to handle potential null values, as the field might not always be present or filled during the transition.