How to force a text field to accept only numbers following by letter d using ScriptRunner Behavior

Mahdi Challouf April 28, 2024

Dears,

Currently, I'm tasked with creating a text field tailored for estimations within Jira Cloud. This field should exclusively accept numerical values followed by 'd' for days or 'w' for weeks.


The desired format is akin to '1d', '5d', or '1w'. While I've successfully implemented this functionality in Jira Data Center using specific code

def estimationField = getFieldById("customfield_10647")

def estimationValue = estimationField.getValue()

estimationField.SET_DESCRIPTION("(eg, 4d, 1w)")

if(estimationValue !="" && !estimationValue.matches('(^[0-9]*+d')){ estimationField.setError("estimation should be in days") }

else { estimationField.clearError() }

I'm encountering challenges adapting it for Jira Cloud. Any assistance in achieving this goal would be greatly appreciated.

Thank you.

1 answer

1 vote
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.
April 28, 2024

Hi Mahdi,

Where are you stuck on "adapting it for Cloud"?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events