Redirect approvals to another user permanently when a Employee leaves the company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 03:36 AM
Hi,
Redirect approvals to another user permanently when a Employee leaves the company.
ex : Employee X has left the company . Employee Y has to get his requests to be approved further (in future) .
Employee Y is not Delegate for Employee X here.
How to change the approval (sc_req_item) to Employee Y ?
regards,
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 07:33 AM
workflow.scratchpad will accessible only from the workflow. In your case I would suggest to store it on a field of RITM table. Once done you can use g_scratchpad() that would pass value from RITM to approval table.
https://www.servicenow.com/community/developer-forum/workflow-scratchpad/m-p/1837158
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 07:43 AM - edited 02-14-2024 07:47 AM
Hi @New Developer_S ,
Create a Business Rule (or) fix script on the user table "User(sys_user)" table and add the conditions.
For Business rule Condition: When Active Changes.
For Fix Script: Query that particular user.
In the same Business Rule, query the "Approval(sysapproval_approver)" table and check in the "approvals" are requested stage. And replace User X with, User Y in the same approval record.
If it is one time job just use the User Y sys_id in the script.
If you want to do the dynamic script, you should have a flag (or) query to find out User Y.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:29 AM
Hi Sumanth,
Yes I have ran a fix script for current requested items.to change to the User Y . but we need to check for further future approvals should also go to Y only.Do you have any solution for this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:38 AM
Hi @New Developer_S ,
Create a Business Rule on the User table when the Active flag changes to false.
In the Business rule script query Approval(sysapproval_approver) table with the Approver(query using current.sys_id ) query and state is requested. If you find any approval record with those queries, in the while loop replace the Approver field value with sys_id of approver Y.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda