When using an approval script in Group Approval activity to calculate the number of approvals needed, approvals in Group approval Activity are incorrectly being set to "No Longer Required" and the workflow hangs on this activity.
The sysapproval_group records have an invalid value in the 'approval' field when this issue occurs.
This issue arises when approval script is not always guaranteeing the value of global variable "answer" after every update to 'sysapproval_group.approval' field.
For example, in this particular approval script, the answer variable is blank until 50% of the groups have approved. Because of this, some invalid value('sn_comm_management.CommunicationManageme') from the plugin is being set in the global variable 'answer'. This will result in unexpected behavior on the workflow execution of Approval Group activities, such as:
- Finishing the Approval Group activity with result "sn_comm_management.CommunicationManageme"
- Setting sysapproval_group.approval = "sn_comm_management.CommunicationManageme" for other approval group records
The workflow activity definition script of "Approval Group" is always expecting the global variable "answer" value to be a valid approval state in all cases, especially after an update to 'sysapproval_group.approval' field is being done within "Approval script", this global variable must be set in all scenarios.