JMWE post functions seem not to be executed

Bertrand_DELAITRE December 10, 2018

Using JMWE 5.7.0 and JIRA 5.4.2

 

No post-function seems to be executed. I've verifed Workflow and permissions and everything is OK.

I've tested post-functions within the Groovy editor and they don't throw any error.

 

Any idea?

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2018

You first need to make sure you have published your workflow. 

After that, you should check the Jira log file for errors. 

Also, what do you mean by you "tested the post-function in the Groovy editor"? Which post-function are you using? And are you using some Groovy code in it?

Bertrand_DELAITRE December 10, 2018

Ah, ah. You give me an idea: look in log files !!!

 

I don't have access to the server, so I need to ask our admins. I'll come back with answer about log files.

 

For post-functions, I'm using groovy script to set value to fields. In the editor, there is a button to test the script and I've no error when testing.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2018

You don't have to wait for your admins, you can use the Last Log app to access your log files.

Are you using the Set Field Value post-function? Can you share your script?

Alternatively, you can open a support request here: https://innovalog.atlassian.net/servicedesk/customer/portal/8

Like Bertrand_DELAITRE likes this
Bertrand_DELAITRE December 10, 2018

Thanks for this plugin. I'll ask our admin to deploy it on our production server !!!

I've just uploaded it to my test server and it seems to work fine. But I don't know what to search. Nothing found looking for "JMWE" or "innovalog"

Bertrand_DELAITRE December 10, 2018

Here's a postfunction I use

The value of field Analysis responsible of the current issue will be set to the value of the following Groovy Expression

import com.atlassian.jira.component.ComponentAccessor;

log.warn("JMWE post-fct -- Submitted-->Analyse-->Analysed -- If Analysis responsible is not set then set it to Current User");
log.warn("Setting Analysis responsible to " + ComponentAccessor.getJiraAuthenticationContext().getUser());

return ComponentAccessor.getJiraAuthenticationContext().getUser();

(unless the field already has a value).

Analysis responsible is a custom field

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2018

FYI, the current user is available directly as the 

currentUser

variable (no need to use the JiraAuthenticationContext)

And since you added WARN-level logging, you see definitely see these log messages in the Jira log file. Are you sure you deployed the workflow draft?

Bertrand_DELAITRE December 12, 2018

YES, workflow is active. And no trace in log file

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2018

Unless your admin disabled WARN-level logging on your Jira instance, you should definitely see either your log.warn messages or, if your script is incorrect, an ERROR that include "com.innovalog.jmwe" in its stack trace. You can try using log.error instead to see if that changes anything.

What is the type of your Analysis responsible field? Also, did you try without the "Set only if empty" option)? That would totally explain the absence of any log entry, if the field is not empty when the post-function runs.

Also, you might want to add another post-function (preferably not one of JMWE's) to make sure there is no confusion of transitions (you should see the outcome of that other post-function when you transition the issue).

Bertrand_DELAITRE December 13, 2018

OK. Found that post-functions are executed if all mandatory fields are filled up before doing transition. the post-function to set values for mandatory fields seem to be processed after "mandatory" check :(

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2018

Post-functions are executed post transition (hence the name). During a transition, things happen in this order (on Jira Server at least - Cloud is different):

  1. Workflow Conditions check whether the transition should be available
  2. If available, the user triggers the transition (presses the transition button)
  3. The transition screen is displayed (if any)
  4. The user submits the screen
  5. Mandatory fields (as defined in the field scheme) are checked
  6. Workflow Validators check the validity of what was entered on the screen
  7. Workflow Post-functions run, including the built-in ones such as the one that saves the issue with its new status and field values
  8. The transition screen is closed, and the issue is updated in the browser

What is it exactly that you were trying to do? Update the issue before the transition screen is displayed? Unfortunately, that is not possible with workflow extensions.

Like Bertrand_DELAITRE likes this
Bertrand_DELAITRE December 13, 2018

I search for an issue. Then, I click "Analyse"  (Workflow button at the top of an issue), I've got a new screen with mandatory and non mandatory fields.

One mandatory custom field is "Analysis Responsible". I need to set it to current user if the field is left empty by the user when clicking "Analyse" on the bottom right of the screen.

Hope this is clear enought

Bertrand_DELAITRE December 13, 2018

I'm sorry. Seems that I've not read correctly your explanations. So mandatory fields are check before post-function. This is my problem.

 

Thanks

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2018

But then, why make the field mandatory if the user doesn't need to enter a value?

Bertrand_DELAITRE December 13, 2018

That is a good question !!!! Someone provides me the configuration and made a mistake. The fields should not be mandatory if using post-functions to set them !!!

 

Thanks again for your help :)

0 votes
Bertrand_DELAITRE December 10, 2018

Strange. Works for one workflow but not for another one. Keep looking in log file and configuration if I made something wrong

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events