I want to set the value of urgency custom field based on the value of priority and impact custom fields

Inas Labib October 29, 2015

Hi,
I have a request to automatically set the urgency custom field value based on the value of other two custom fields (priority and impact). We have script runner installed but don't know what is the best way to do that.
Note: we want to set this while creating the issue,but not as a post function.
Thanks

2 answers

2 votes
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.
October 29, 2015

I'm not sure I understand this "while created, not as a post function".  The create transition has a post-function which is the perfect place to do it - user has put in good data, commited the new issue, perfect time to work out and populate another field.

Your script boils down to

  • get custom field value (impact)
  • get priority field value
  • perform logic
  • set custom field value (target)

There are quite a few examples at https://scriptrunner.adaptavist.com/latest/jira/quickstart.html

0 votes
Inas Labib October 31, 2015

I meant while creating the issue, I don't want to set this value after creating the issue. I want to get this field filled on the create screen itself.

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.
October 31, 2015

Ah, I see, you want to fill a field with a default value based on other values, allow the user to overwrite it, and have their data over-written if they go back and amend the other values. Definitely possible, but best done in javascript, which isn't my field.

Inas Labib November 1, 2015

Thank you very much for your reply. I already created the java script and I put it in the field description but the problem that if I changed the project or the issue type and changed it back to the issue that has this script in one of its filed, Jira does not load the script again, it just ignore it.

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.
November 1, 2015

That's one of the (many) reasons not to try it in javascript and do it the reliable way, in a post-function. For javascript, you're going to need to intercept new page and refresh and update page and other javascript events that update the page.

Suggest an answer

Log in or Sign up to answer