I have a transition with 8 post functions. Here is the sequence of the post functions:
1. Update Any Issue Field (JSU) - updates customfield_A value to %%CURRENT_USER%%
2. Update Any Issue Field (JSU) - updates customfield_B value to %%CURRENT_DATETIME%%
3-7. All the five essential post functions
8. Custom script post function (Adaptavist) - gets the issue key then runs a script in the local Jira server which includes using the key to curl for the current issue JSON
Now the problem is, post function no. 8 acquires the issue JSON of the previous issue state (not status), meaning customfield_A and customfield_B still have null values. I tried putting sleep before the curl command to check whether Jira needs time to update the issue (while also increasing the waitFororKill of the groovy script) to no avail.
I also tried this scenario to confirm that the previous state is what's being curled:
a. User1 performs the transition from statusX to statusY at time1 - customfield_A and customfield_B returns null
b. Looped back from statusY to statusX
c. User2 performs the transition from statusX to statusY at time2 - customfield_A has a value of User1 and customfield_B has a value of time1
My question is, is this a problem with my post function arrangement or is this an expected behavior?
In point 8, the post-function has direct access to both the old and new values on the issue, so I'm not sure why you are issuing a curl to fetch the old data.
Hello Nic. I am actually trying to fetch the new data but what I end up getting is the old data. For getting the new values on the issue, I want to get the whole issue detail in JSON format and place that in the local Jira server. I'm not sure if there's a way to do that in script runner but what I've tried so far is just getting fields one by one, and I don't exactly want to list all the custom fields in the groovy script. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that's because you're getting existing data before it is updated.
I don't understand why you are trying to get it at all, when the post-function has direct access to both old and new data.
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.