so basically item.getOwner(); is always returning original owner of the workitem. but i need to grab workitem owner after its being forwarded in order to check if its delegated owner is same person as requester.. but method getOwner(); is only giving me original owner of the workitem.. so is there any method i can check who is the exact approver of the workitem???
Your program should work as expected. When the requester and the delegated owner are the same, it will return the manager of the new owner.
item.getOwner() will return the current owner of the work item, not the original one. For example, if the initial owner was X and the item was forwarded to Y, then item.getOwner() will return Y, while X will be stored in the work item’s owner history.
Could you please share the work item object with me so I can review it further?
Based on the example above, your rule is working correctly. The current owner of the work item is AB3117, and you forwarded two times to the same user AB3117 (as per the owner history). The requester is NP36FH.
If you instead forward it to NP36FH, then your rule will return NP36FH’s manager.
ok the thing i noticed was if i dont apply any global forward rule i am getting new owner as myself in owner history but once i add global workitemforward rule its giving me original owner only in workitem xml.
The Global work item forwarding rule is more open-ended; if one is specified, it runs every time a work item is opened or forwarded in the system to determine if the work item needs to be sent to a new owner for further analysis or action. Only one global forwarding rule can be specified per installation, but it is important to note that it runs for every work item every time it is opened, so complex and time-intensive logic in the rule could substantially affect system performance.