Behaviours Plugin - Server side scripting

Hi,

I have a behavior set to make a field required based on value selected on different field. There are two custom fields: Request Type (select field) and Client ID (Text). I want Client ID to be required based on the value selected in Request Type field. This is what I have so far. Seems like script is compiling but it allows me to submit a ticket without a value in Client ID.

FormField requesttypeField = getFieldByID("Request Type")

FormField clientidField = getFieldByID("Client ID")

if (requesttypefield.getValue() == "New LG Request")

{

clientidField.setRequired(true)

}

How do I know if the code is executed on the submit form?

JIRA version 5.1.3

Behaviours Plugin version 0.5.2

3 answers

1 accepted

Hi Jamie,

You can close this ticket. I tried the script with field id and it worked!

FormField clientID = getFieldById("customfield_12936") //Client ID field / customfield_12936

0 vote

Are you sure it's compiling? If you use the field name, you should use getFieldByName(...)

I tried with getFieldByName("Request Type") and getFieldByName("Client ID")but client id is still not required. I also tried with by setting a condition as workflow step = Open. It did not work.

When I inserted the code and clicked on update I did not get any error. Thats what i meant by compiling.

Make sure the behaviour is applied, check the logs. You can up the logging from the main behaviours screen.

Is the script attached to the "Request Type" field?

Jamie, I had the script attached to Client ID before. I changed it to Request Type but the result is same. Attaching the ss:

Hi Jamie, were you able to see the screenshot?

Nope.

(filler).

Hi Jamie,

Sorry for submitting this question here but i was not sure where else to go. I submitted 2 questions on Behaviour plugin on May 21st but it is not visible in my questions queue. Any idea what happened? Where can i go for this kind of support?

thank!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

173 views 0 4
Read article

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