Hi, I need help with the script runner plugin..
I'm not to sure how to code this but I am trying to populate a user field based on a text field that is already populated and visible within View, e.g. TextField = A, Userfield = a@example.com.
I understand the behaviour plugin can be used to do this , I am running JIRA v5.2, Behaviours V0.5.3 and Script Runner V2.1.15.
Another question was scripted fields and the coding style/syntax, how different is it compared to the server side scripts written within the behaviours. e.g. if I have a working scripted field, can I move the code from there to the server side script without any issues?
All help is very much appreciated.
Community moderators have prevented the ability to post new answers.
Can you describe what you're trying to do? It sounds like the user picks a user, and you want to show their email address?
> can I move the code from there to the server side script without any issues?
not trivially, no.
Someting like this:
def managers = [ "AMER": "bob@example.com", "EMEA": "steve@example.com", ] def managerField = getFieldByName("Manager") def regionField = getFieldById(getFieldChanged()) managerField.setFormValue(regionField.getFormValue())
You add this behaviour to the Region field or whatever, so when it changes this code is called.
Hi Jamie, basically I have 4 regions EURO, AMERICA, ASIA, and AFRICA which are displayed in a text field per issue, these are picked on the Create Screen. which is then in the status Open, I have a transition called Start Progress which puts the status in Start Progress, during this transition I need to send an email, to the manager of that specific region, (EURO AMERICA ASIA Or AFRICA) Dependent on the region that is chosen.. So that is why it will be adding an email address to a user field or text field which the post function can use to send an email to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your help is very much appreciated..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, tested your code today and it seems to be retrieving the value of the select list value ID's instead of the fixed email address? (e.g. in Managers if AMER is selected them it will display 17691 (Which is AMER's Value ID))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also since the field Region is auto populated during Create is it possible to retrieve the value through transition and update the manager field accordingly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To update when used in a text field it is simply duplicating the value.. e.g. If A is entered then Manager value is A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.