- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 06:34 AM
Hi there,
I want to identify the last approver in a workflow and then use this as a condition elsewhere. Is there a way to find the final approver if there are several potential stages (eg there is a 1st approver in some cases, and then for some 2 etc).
If this is possible I would appreciate some pointers and if not, is there a way to retrieve where the workflow ended? So if the workflow ends at the 2nd Approver stage, is there a way for me to extract this information, or would I have to go in manually to look at how far along the flow it is?
Thank you
G
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:33 AM
The original solution was deleted which made me reinvent the wheel. In my case i had to auto approve if the approval was not received within the next day. And wait for approver if the approval was the final approval.
My solution to solve this problem relies on the table data available on wf_transition table.
Using a BR or daily schedule job we can use the following logic.
GlideRecord approval table, condition such as
state is requested
AND
due date yesterday.
Loop through the records and then GlideRecord wf_transition table based on the records
Condition like
from.sys_id of approval 'wf_activity' field
AND
to.activity_definition CONTAINS approval
AND to.activity_definition is NOT approval action
Note: This ensures that the next activity is anything but approval activity that is other way of saying this is not the final approval at all or there are sequential approvals. However, if workflow activity like create catalog task is present between two approvals activities, then the first approval would be considered the final approval.
Now if it returns any record
Then update the state of approval field to 'not_required'
Finally update the workflow of the ritm similar to nudge ui action button.
Shariq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:16 AM
This is wonderful, thank you so much for your response and I will try and implement this.
Thank you,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 09:51 AM
what was the suggestion? seems the user has deleted their response?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 04:39 AM
The solution was actually quite long winded but I'll try and outline the rough process below:
- In script Include: 2 functions. One function ascertain the level of the approver. The groups were stored, the sys_id of the user was checked thereafter against this list and the output of this function was a number, 1, 2, 3, depending on the level to which level they fit into.
- The second function checks the sys_id of the user and sees which group they are in to see if they are an approver at all. This then calls the above function to check what level approval the user is in. Once the level of approver is ascertained, the final approver level is compared the level of the currently logged on user and returns true or false if they are the final approver (meaning their level numbers were equal).
- This was then called within a UI action condition to ascertain whether the currently logged in user is the final approver and hence able to carry out the UI action.
It's been a while since I looked at this, so it's quite rough, but hope it helps.
Kind regards,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:33 AM
The original solution was deleted which made me reinvent the wheel. In my case i had to auto approve if the approval was not received within the next day. And wait for approver if the approval was the final approval.
My solution to solve this problem relies on the table data available on wf_transition table.
Using a BR or daily schedule job we can use the following logic.
GlideRecord approval table, condition such as
state is requested
AND
due date yesterday.
Loop through the records and then GlideRecord wf_transition table based on the records
Condition like
from.sys_id of approval 'wf_activity' field
AND
to.activity_definition CONTAINS approval
AND to.activity_definition is NOT approval action
Note: This ensures that the next activity is anything but approval activity that is other way of saying this is not the final approval at all or there are sequential approvals. However, if workflow activity like create catalog task is present between two approvals activities, then the first approval would be considered the final approval.
Now if it returns any record
Then update the state of approval field to 'not_required'
Finally update the workflow of the ritm similar to nudge ui action button.
Shariq