Second Approval not required if selected user is same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:16 PM - edited 08-04-2025 11:20 PM
HI All,
There is a requirement like in a catalog form there is two field with reference type and one field is Variable filed with name ABC Owner and second field is Variable set Data Owner and both are reference type field with sys_user table and if i select same user in both field than an additional approval is not required only one approval required but if i select both diffrenet user than 2 approvals is required. For example, if Aman is the ABC Owner, provides her approval and then is also one of the Data Owner approvers listed, a 2nd approval is not required to generate for Aman.
How to achieve this in workflow.
Thank You!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 11:24 PM - edited 08-04-2025 11:27 PM
Hi @Ajay Singh2 ,
In your Workflow, configure activities like below steps
- Approval Activity (ABC Owner): Add an "Approval - User" activity to request approval from the "ABC Owner" variable. Configure this activity to use the value of the "ABC Owner" variable as the approver.
- Conditional Activity: After the ABC Owner's approval, add a "Conditional" activity. This activity will evaluate whether the "ABC Owner" and "Data Owner" variables contain the same user.
- Condition Script: Within the "Conditional" activity, use a script to compare the sys_id of the users selected in both variables.Script
- answer = ifScript();
function ifScript() {
var abcOwner = current.variables.abc_owner.sys_id; // Replace 'abc_owner' with your actual variable name
var dataOwner = current.variables.data_owner.sys_id; // Replace 'data_owner' with your actual variable name
if (abcOwner == dataOwner) {
return 'yes'; // Same user, no additional approval needed
} else {
return 'no'; // Different users, additional approval needed
}
} - Approval Activity (Data Owner - if different):
- If 'no' (different users): Connect the 'no' path from the "Conditional" activity to another "Approval - User" activity. Configure this activity to request approval from the "Data Owner" variable.
- If 'yes' (same user): Connect the 'yes' path from the "Conditional" activity directly to the next stage of the workflow, bypassing the second approval.
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP
- If 'no' (different users): Connect the 'no' path from the "Conditional" activity to another "Approval - User" activity. Configure this activity to request approval from the "Data Owner" variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 02:17 AM
But data owner is a variable sets than how will check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 02:21 AM - edited 08-05-2025 02:23 AM
You should use current.variables.<variable_name> eventhough your variable present in Variable set
And compare in conditional script which I shared
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 02:27 AM
when you use "Get Catalog Variables" flow action you can grab variables within Variable set as well.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader