jirajqljqlite

JIRA - JQL with Webook - Only trigger webhook if change was not caused by certain user


We're using Slack and JIRA together and we want to create one webhook for every of our users. If any user A makes a change in user B's issues, user A should be notified via Slack. But if user A makes a change in user A's issues, user A should NOT get a notification in slack.

We tried the following JQL statement for the user "max":

project = "Project Name" AND assignee="max" AND NOT status changed AFTER "-2m" by "max"

Unfortunately it does not work.

If Max makes a change to his issues, he gets a notification in Slack, but if he changes the same issue again afterwards, he does not. It seems like the "status change by" is not set at the time the webhook is triggered, but only afterwards. Is there some kind of field for the User who triggered the webhook? That is essentially what we need.

EDIT:

More info: We're using this Slack integration and combining it with the webhook: https://marketplace.atlassian.com/plugins/eu.wisoft.slack.jira/cloud/overview

I created an additional "all Jira notifications"-configuration with this Slack-plugin and it works quite fine. Hence, the slack plugin does work fine, but my JQL filtering is the issue apparently.

Last try:

project = "Project Name" 
AND assignee="max" 
AND status changed AFTER -2m 
AND NOT status changed by "max" AFTER -2m

Using this from a comment, I was able to get it to work inconsistently: A new jira-issue that I put on Todo with "max" and assignee "max", that is moved by another user to "Progress" (hence status-change), does not cause the webhook to trigger. The next time, the same user changes this issue from progress to todo or back, the webhook is triggered. It feels like at the time of the webhook call, the latest information is not available. It feels like at the time of the first change, this part fails:

AND status changed AFTER -2m 

How could I fix this?


Solution

  • I think the JQL you're looking for is this:

    project = "Project Name" 
    AND assignee="max" 
    AND status changed AFTER -2m 
    AND NOT status changed BY "max" AFTER -2m
    

    This is telling JIRA:

    Give me everything in project-name;

    That is owned by max;

    Limit it to anything where the last status change was after 2 minutes ago

    Further limit it so that the last status change was NOT done by max in the last 2 minutes