The Approval notification is not sent when a Service Management Request is waiting for an approval

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

When a Service Management request transitions to an approval status, the approval notification is not sent to the approver(s) although it should.

環境

  • Jira Service Management Server/Data Center on any version from 3.0.0
  • The request is using a workflow with an approval status

Expected behaviour

A customer notification of type Approval Required should be sent to all the approvers defined in the request:

原因

この問題は、次のいずれかの理由で発生する可能性があります。

  • Root cause 1
    • The customer notification of type Approval Required is disabled
  • Root cause 2:
    • The Approvers field used to list the approvers of the requests does not match the field defined in the approval status of the workflow
  • Root cause 3:
    • The Customer Request Type field was not set before the request transitioned to the status that requires an approval
  • Root cause 4:
    • The Approvers field was not set before the request transitioned to the status that requires an approval
    • This situation can happen:
      • If the Approvers field is set via the UI after the request entered the status that requires approval
      • Or if the Approvers field is set automatically during the transition going to the Approval status (via a post-function coming from a 3rd party add-on, or via some automation)
  • Root cause 5:
    • The request is transitioned a 2nd time to the same status that requires approval (the notification was sent the 1st time, but not the 2nd time)
    • (warning) This root cause is only valid for JSM versions up to 4.18.x
  • Root cause 6:
    • The post-function Set issue status to the linked status of the destination workflow step is missing from the transition going to the Approval status
  • Root cause 7:
    • There is a post function by a third-party plugin, such as a Groovy Script, that changes the issue before the transition "Set issue status to the linked status of the destination workflow step"
  • Root cause 8:
    • There is a Script coming from a third-party plugin (such as ScriptRunner), which is setting the flag shouldSendMail to false, and prevents the Approval Required customer notification from being sent

診断

  • Root cause 1
    • Check if the customer notification of type Approval Required is disabled via the page Project Settings > Customer Notifications within the Service Management project configuration.
    • In the screenshot below, it is disabled:
  • Root cause 2:
    • Check how the Status that requires an approval is configured in the workflow via the page Project Settings > Workflows within the Service Management project configuration
    • In the screenshot below, we can see that the field used to see which users should get a notification is called Approvers. We need to make sure that the same field is used to set the approver of the request during its creation:

  • Root cause 3:
    • For the approval notification to be sent, it is required that the Customer Request type field is set before the request enters the Approval status
    • If a request is created via the Create button from Jira UI and not from the Customer Portal, the Customer Request type field will not be automatically set and the approval notification from be sent:
       
  • Root cause 4:
    • For the approval notification to be sent, it is required that the Approvers field is set before the request enters the Approval status
    • Check the history of the ticket to see if the Approvers field was set before the issue transitioned to the Approval status
    • Check the post-functions from the transition that directs to the Approval Status
      • If the Approvers field is set via a 3rd party add-on post-function or script, there is a chance that, due to some race condition, the Approvers field won't be set "on time" (before the request enters the approval status)
      • In such case, you might notice that the approval notification might randomly be sent or not sent
  • Root cause 5:
    • Because of the bug linked below, the approval notification is only sent the 1st time the issue transitions to the approval status. If there is a transition configured to re-enter this status, then no approval notification will be sent
    • (warning) Note that the bug was fixed in JSM 4.19.0, so this root cause only applies to JSM on lower versions
  • Root cause 6:
    • Check the post-functions from the transition that connects to the Approval Status
    •  If you see that the Set issue status to the linked status of the destination workflow step post-function is missing, then it's probably the reason why the approval notification is not sent
    • (warning) Note that this post-function cannot be deleted when using Jira out-of-the box, so this case should be rare. However, it seems that some 3rd party add-ons make it possible to remove it


  • Root cause 7:
    • The post-function is causing a race condition, which breaks the approval system from identifying that issue has an approval required one
  • Root cause 8:

    • To verify if this Root Cause is relevant, check the points in the expand section below in the right order:

      ここをクリックして展開...
      1. Go the Audit Log page from the Approval Required notification (via the page Project Settings > Approval Required)
        • Check if the automation was triggered for the problematic issue key.
        • If it was triggered, check if Send email action was successfully executed (with a green (tick) icon), as shown below:
        • If the action was successfully executed but the approval notification was not sent, move on to the next step below
      2. Replicate the issue by following the steps below:
        1. ページ ⚙ > [システム] > [ログとプロファイル] に移動
        2. Click on Configure logging level for another package and add the package com.atlassian.servicedesk.plugins.automation with the option DEBUG
        3. Replicate the issue
        4. Check the Jira application logs (atlassian-jira.log file) and look for a line similar to the one below. Check the flag shouldSendMail in the Rule message data. If it is set to false, then this Root Cause might be relevant and move on to the next step below.

          2023-02-23 15:44:48,869+0100 PsmqAsyncExecutors-job:thread-1853 DEBUG admin 944x128585x1 gq57f3 XX.X.XXX.XXX /servicedesk/customer/portal/4/create/109 [c.a.s.p.a.i.e.engine.process.ExecutionJobProcessorImpl] Executing rule with the 'admin' user with the following rule message: RuleMessageImpl{data={newApproversKeys=["JIRAUSER10000"], issueId=10000, issueKey=ABC-123, shouldSendMail=false, currentUserUserKey=JIRAUSER10000, eventTimeKey=1677163488797, projectId=10100, inCustomerContext=true, ruleSetId=51}}


      3. Let's check if there is a ScriptRunner script that is executed when the request that requires approval is created
        1. Check the post-functions from the transition that connects to the Approval Status (usually it is the Create issue transition from the approval workflow)
          1. If you find a ScriptRunner post-function that is updating the issue, try to disable it and and see if the problem goes away
        2. Go to the page ⚙ > Manage Apps > ScriptRunner, click on the Listeners tab
          1. Check if you see a script that is executed on the Issue Created event
          2. If you find one, try to disable it and and see if the problem goes away
        3. If you did not identify any problematic script, the last thing you can try is disable the ScriptRunner app and check if the problem goes way:
          1. Schedule some maintenance window
          2. Go to the page ⚙ > Manage Apps > Manage Apps
          3. Disable ScriptRunner and check if the problem goes away
          4. Re-enable ScriptRunner
      4. Conclusion:
        1. If the issue did not go away after disabling the ScriptRunner script(s) identified in the previous step, or after disabling the whole add-on:
          1. Then this root cause is not relevant
        2. If the issue went away after disabling the ScriptRunner script(s) (or disabling the entire add-on) in the previous step
          1. This this root cause is relevant

ソリューション

  • Root cause 1:
    • Re-enable the Approval Required type notification:

  • Root cause 2:
    • Make sure that the Approvers field used in the Approval status configuration is the same field used to set the list of approver(s) during the request creation
    • (warning) Note that it is possible that you might have duplicate fields with the same name Approvers. Make sure that it is not the case by looking for this field in ⚙ > Issues > Custom fields, and ensuring that there is only 1 custom field with that name
  • Root cause 3:
    • Make sure that the Customer Request Type field is always set before the request enters the Approval status (by ensuring that the request is created from the portal instead of from the Jira UI)
  • Root cause 4
    • Make sure that the Approvers field is always set before the request enters the Approval status:
      • if the Approvers field is set manually in the UI, make sure that this field is set either at the request creation, or while the request is in a status located before the status with approval
      • if the Approvers field is set via a 3rd party post-function, one way to ensure that this field is set early enough (before the request enters the status with approval) is to:
        • Add an intermediate status in the workflow (let's call it "intermediate" status)
        • Add a transition that connects from the issue creation to the intermediate status, and move the 3rd party add-on post-function there
        • Add a transition that connects from the intermediate status to the approval status
        • (warning) Optional: create a Service Desk automation rule (via Project Settings > Automation) that will automatically transition any ticket from the "intermediate" status to the status with approval
  • Root cause 5
    • Upgrade the JSM application to the fixed version 4.19.0, or any higher version
  • Root cause 6
    • Add Update Issue Status (Sets issue status to the linked status of the destination workflow step) to the list of post-functions:
    • The transition should now contain the Set issue status to the linked status of the destination workflow step post-function:
  • Root cause 7
    • Move the third-party post function to the bottom of the transition list
  • Root cause 8
    • Disable the problematic ScriptRunner scripts identified during the diagnostic steps
    • Reach out to the ScriptRunner support team for assistance (ScriptRunner scripts are not supported by Atlassian)


問題が引き続き発生する場合、あるいは診断ステップのクエリが結果を返さなかった場合は、https://support.atlassian.com/ja/ からアトラシアン サポートにお問い合わせください。


最終更新日: 2023 年 12 月 28 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.