I have a group picker in Create screen with some logic(Behaviours Groovy script) to filter the values in it and I have to add those filtered values to group picker. This may work using post function (as mentioned in https://www.adaptavist.com/doco/display/SFJ/Set+a+multi+group+picker+custom+field+via+a+post+function) because an Issue object will be created and available by this time.
But in my case, I have this group picker in Create screen and hence, Issue object will not be created yet.
Can someone help me in adding the filtered values to group picker without Issue object using Groovy?
Appreciate your help!
You can use your code as a post-function in the 'Create' transition. You just have to be aware, that your code will be executed after the first step "1. Create the issue".
Create a new custom script function in the post-function section of the workflow transition and then click on the little arrow on the right side to put the code one step later.
Thanks for your reply Thomas.
As you said I can put my code as post-function, in general, post-function executes after the transition (in this case Create transition). But my Group Picker is present in Create screen itself. That means the values must be filtered and available in Create screen itself (before the post-function) as per my groovy logic.
If I use 'Issue' object to set the custom field in my logic, the issue object is returning 'null' because the issue bject has not yet created in Create screen (before clicking on Create button).
The other way around I believe, this can be achieved is, we should be able to execute the logic when we click on Group Picker icon. Then it executes my logic and pulls out the filtered data on the Group Picker window. I am not sure how this can be achievable.
I am sorry, i missunderstood you.
If you already use Behaviours Groovy Script to filter the values, you should be able to set the value of the formfield with the following expressions:
def singleGroupCF = getFieldById("customfield_11111") singleGroupCF.setFormValue(value)
I hope that this approach will work.
I tried the way you mentioned above. Seems the values are being set to the Group Picker field (values obtained from my logic are printing in the log). But when I click on the Group Picker icon, it seems, the Group Picker default query is executing and overriding my values in it. So, by default all the values are populating irrespective of my logic.
So I believe, there needs to be done something when we click on Group Picker icon.
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot