How to send approval based on field update on the catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 03:43 AM
Hello Experts,
I have created ABC catalog item to update existing user record. In that catalog item I created below fields.
1. Select User name (string)
2.Name(string)
3.Email
3.Cost center(reference to cmn_costcenter table)
4.Department(reference to cmn_department table)
5.VIP (true/false)
6.Country (dropdown)
7.Company(reference to core_company table)
8.Title (string)
9.Manager(reference to sys_user table)
Created catalog client script if user selected user name in field 1 then remaining fields will populate automatically.
Now my requirement is,
1.If user updated 2nd field or 3rd field or 4th field then we need to send approval to Department.Manager.
2.If user updated 5th or 6th or 7th fields then we need to send approval to Company.Assignment Group
3.If user updated 8th and 9th fields then we need to send approval to current.manager
Here the problem is how to know end user how many fields updated in catalog item. We need to compare old value and new value for all the fields.
If new value is same as old value we need to skip for approval.
If new value is not equals to old value then we need to send approval.
How can we do that by using script in workflow...?
Best Regards,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 03:55 AM
Hi @raj149
Created catalog client script if user selected user name in field 1 then remaining fields will populate automatically.
Atul: Use Auto populate feature on variable, which is zero code.
https://www.servicenow.com/community/itsm-forum/send-approval-based-on-a-variable-value/m-p/811170
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
01-18-2024 04:04 AM
Hello @Dr Atul G- LNG
Above links which you shared it is not helpful for me.
Now my requirement is,
1.If user updated 2nd field or 3rd field or 4th field then we need to send approval to Department.Manager.
2.If user updated 5th or 6th or 7th fields then we need to send approval to Company.Assignment Group
3.If user updated 8th and 9th fields then we need to send approval to current.manager
Here the problem is how to know end user how many fields updated in catalog item. We need to compare old value and new value for all the fields.
If new value is same as old value we need to skip for approval.
If new value is not equals to old value then we need to send approval.
How can we do that by using script in workflow...?
Best Regards,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:10 AM
My friend, that is baselines for you. You need to write the script and check. If you looking for ready made code may be someone from chatgpt can build in seconds and give.
My motto is , to give a baseline and you try your hand and share fedback. Please try to build and if you stuck , let us know.
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-08-2024 09:12 PM - edited 02-08-2024 09:12 PM
We can't achieve this in workflow directly..
Do it onChange scripts by comparing old and new value..if equals then g_form.setValue("flag", false)..else setValue flag as true and (include require approval details in ApprovalvariableName)
In workflow activities...check if flag==true
Use array.push( current.varibales.approvalVariableName);