Hi All, I am trying to make a post function that will fire when the condition is true. can you help me? I need to fire the event when request name is ABC, if not , post function will not fire. Here is my code
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_xxxxx")
ApplicationUser user = issue.getCustomFieldValue(cField) as ApplicationUser
UserManager userManager = ComponentAccessor.getUserManager();
issue.setReporter((user))
Thanks
So change it so there are two issue types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist-, I think I can achieved it using fire post function when a condition is true
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist- , Scenario is I have several request. example is I have 3 request . ABC, DEF, GHI . when the user raise a request using ABC, my post function will fire. if not., post function wont fire.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, so have two workflows, one with the post-function, and one without it. Set up Jira to use the workflow with the function for project ABC, and use the other for projects DEF and GHI
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist- , can't I just use the fire an event when the condition is true? I want to utilize that if condition, can you help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Firing an event has nothing to do with what you're trying to do.
Conditions control the use of transitions, they would block the whole transition (so not only would you not run your post-function, you would also not make any changes to the issue, or fire the events)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist- , can you then enlighten me where to use these firing an event when condition is true?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't. Conditions are there to control the use of transitions. Events have nothing to do with what you have described as what you want.
Your requirement appears to be to have one set of issues run this post function, and another set not. To do that, separate out the issues into two different types, and have different workflows for them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Hi @Nic Brough -Adaptavist- , what about if the post function will fire only if a custom field has a value? can I do that on post function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist- , I am not talking about projects, I am talking about request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I assumed they were projects. But, lets say ABC, DEF and GHI are request types.
You can map ABC to issue-type 1, and then DEF and GHI to issue-type 2, then you use the workflow with the post-function for issue-type 1 and the other one without the function for issue-type 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A post function always "fires" when you go through a transition, so I'm not sure what the problem here is.
If you mean "it runs, but does nothing", then I suspect it's the setReporter call, but you will need to read the logs to see why it is failing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nic Brough -Adaptavist- , what I mean is that I have several request., If user clicks on ABC request , that code post function woildn't fire. I need help on setting if condition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post functions run during transitions. Just clicking on something isn't going to run a post-function unless it is a transition you are clicking on.
I think you need to describe what you are trying to achieve first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.