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-05-2025 04:50 AM
I used below script after Approval User but its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:03 AM
so you are using workflow and not flow
You are using IF activity in workflow
try this and add logs and see
answer = ifScript();
function ifScript() {
var abcOwner = current.variables.u_frpa_fnrole_owner.toString(); // Replace 'abc_owner' with your actual variable name
var dataOwner = current.variables.u_data_owner_field.toString(); // Replace 'data_owner' with your actual variable name
gs.info('abc owner' + abcOwner);
gs.info('data owner' + dataOwner);
if (abcOwner == dataOwner) {
return 'yes'; // Same user, no additional approval needed
} else {
return 'no'; // Different users, additional approval needed
}
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:43 AM
In both fields i am getting undefined.
Data Owner sys_id: undefined
ABC Owner sys_id: undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:47 AM
variable names are correct?
share variable config screenshots.
both variables are of type reference referring to sys_user?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:52 AM
when i remove .toString() from abc and dataowner than abc sysid get printed but for data owner its undefined i think its variable sets and coming from multirow that why.