Revert approvals status to pending state when work items in RTC are re-opened
![]()
We have a requirement where in we need to set the Approval Status, Approved to Pending when the state of work item is set back to Deferred state i.e If the state is change from Analyzed to Deferred, we need to reset the Approvals filed as Pending.
Can this be achieved using dojo script ?
|
3 answers
![]()
Ralph Schoon (62.7k●3●36●43)
| answered Jul 07 '19, 7:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 07 '19, 7:17 a.m.
Note, it must be implemented in a follow up action/participant. As explained in https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/ an advisor/precondition must not modify the triggering element.
To "Reset" the approval state, iterate all approvals, remove the aprovers, then add the approvers again. That resets the approvers approval state and the cumulative state.
Note: The code always runs in the context of the user doing the work item state change. So for this to work, every rol that can change the work item state and trigger the participant, must be able to modify the approval.
|
![]()
I personally would not do it this way - I would create a second approval instead.
If you roll the existing approvals back then you lose the history of who approved or who didn't and why - by creating a second round approval you get to see both in context.
This would also require no automation extensions - just a process change
|
![]() There is no out of the box option for the requirement in RTC.
Regarding the customization, this cannot be achieved using dojo script based operations advisor as there is no way to access the work item Approvals from the script. The below article has the list of work item attributes that can be accessed via the dojo script: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of
However, you could try to develop a java based operations advisor using PlainJavaClientLibraries to perform the below steps: a. Get the Approvers list when the work item is reopened b. Delete and Create Approvals for the Approvers with the Initial (pending) state on work item save
For more details you could review the below link: |