Change rejection or approval action fails on first attempt for manually added approvals/rejections


Description

The manually added approvals are not getting approved/rejected the first time. The approval is added as a manual approval after the first group approval is approved in an approval coordinator. User will have to approve/reject second time again which is then successful.

There is no event fired to the workflow when the group/approval changes from "not requested" status to "requested" status, so when manual approving the first time, it sends the event to create the scratchpad and toggle back the status to requested.

Steps to Reproduce

1. Create a new Normal change with short description 'test'.
2. This triggers a workflow named "test manual". Create a simple workflow having an approval coordinator, and inside it a two-group approval and Manual Approval.
3. Verify approvals are generated for CAB approval group and capacity mgmt group as per configuration in workflow.
4. Approve the approval from user "Christen Mitchell" for cab first group approval.
5. Add a manual approval for the group "cab approval" from sysapproval_group table parent as the change just created in step 1.
6. Once the manual approval is added, it does not change the state to requested automatically, so change it to requested and reject the approval from "Christen Mitchell". Notice the approval record goes back to the requested state and the user has to again reject which is successfully updated.

Workaround

This problem has been fixed. If you are able to upgrade, review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.

The pre-Orlando workaround consisted in the following steps:

1. Open the business rule "SNC - Run parent workflows (Unapproved) " on sysapproval_group and on sysapproval_approver

2. Click on Advanced section

3. Modify the condition from:

(current.approval.changesFrom('approved') || current.approval.changesFrom('rejected')) && current.approval.changesTo('requested')

to:

(current.approval.changesFrom('approved') || current.approval.changesFrom('rejected') || current.approval.changesFrom('not requested')) && current.approval.changesTo('requested')

4. Open the business rule for sysapproval_approver and navigate to SNC - Run parent workflows (Unapproved)

5. Click on the Advanced section

6. Modify the condition as follows:

((current.state.changesFrom('approved') || current.state.changesFrom('rejected')) && current.state.changesTo('requested')) || (current.state.changesFrom('not requested') && current.state.changesTo('requested') && JSUtil.nil(current.wf_activity))


Related Problem: PRB1357466