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
a month ago
Hello
Can you fix below code for workflow. It always went to no if user is same.
answer = ifScript();
function ifScript() {
var abcOwner = current.variables.u_frpa_fnrole_owner;
var mrvsData = current.variables.u_functional_role_access;
gs.info('ABC owner: ' + abcOwner);
gs.info('Raw MRVS data: ' + mrvsData);
if (!mrvsData) {
gs.info('No MRVS data provided.');
return 'no';
}
try {
var parsed = JSON.parse(mrvsData);
} catch (e) {
gs.error('Failed to parse MRVS JSON: ' + e.message);
return 'no';
}
for (var i = 0; i < parsed.length; i++) {
var row = parsed[i];
var rowOwner = (row.u_frpa_fnrole_owner || '').toString();
var dataOwner = (row.u_data_owner_field || '').toString();
gs.info('Row ' + (i + 1) +
' → u_frpa_fnrole_owner=' + rowOwner +
', u_data_owner_field=' + dataOwner);
if (abcOwner.toString() === rowOwner) {
gs.info('Match found at row ' + (i + 1));
return 'yes';
} else {
gs.info('No match found.');
return 'no';
}
}
}