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 06:54 AM
Hi @Ajay Singh2 ,
if it is multi row variable set, then u need to parse it like below to get data owner value
var mrvsData = current.variables.your_mrvs_internal_name;
if (mrvsData) {
var parsedMRVS = JSON.parse(mrvsData);
// Iterate through each row of the MRVS
for (var i = 0; i < parsedMRVS.length; i++) {
var row = parsedMRVS[i];
// Access individual variable values within the current row
// Replace 'your_variable_name_1' and 'your_variable_name_2' with your actual variable names
var variable1Value = row.your_variable_name_1;
var variable2Value = row.your_variable_name_2;
gs.info('Row ' + (i + 1) + ': Variable 1 = ' + variable1Value + ', Variable 2 = ' + variable2Value);
// You can perform further operations with these variable values here
}
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
a month ago
I tried below code its population correct data in logs but issue is it always went to no when both user are same or different. Please check below code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
please share which variable is outside and which variable is inside MRVS
share screenshots clearly
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
a month ago
This is variable set see below screenshots.
This is variable in form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago - last edited a month ago
Can you move the return 'no' in else condition. Also can you confirm whether it is not printing logs inside catch statement
Modify like below and try