Highlighted
Absent Member.
Absent Member.
314 views

Issues creating approval sequence using javascript to determine approver(s)

Hi Experts!

I'm trying to configure an approval sequence which looks at user selections made on a catalog item and then references a database table to determine the selected user/group's manager (appropriate approver).

Catalog Item Field | Requirement
oceaniaGroup | Requires approval from group manager (working)
user1 | Requires approval from manager (working)
user2-5 | Requires approval from manager (not working)

I had initially tried to set this approval sequence up under a singular approval definition however this appears to set the approvers as the actual approval role names rather than use the javascript approval, essentially routing the approvals to limbo.

As the above didn't work, I have instead setup multiple approval definitions - one for each approval required.
This works if i have the oceaniaGroup and user1 approvals set under Request Level Approvals, but doesn't work if i add the user2 approval, which causes me to get a web service error when trying to log the request.

What i'm absolutely stuck on is this user2 approval. Even if I change the user1 approval to look at the user2 field rather than the user1 field from the request, the approval sequence appears to break and doesn't actually assign any approver despite these fields being nearly indentical (see below).

// WORKS
var requestedUser = svcOps.substring(svcOps.indexOf('id="user1">')+11);
var revisedUser = requestedUser.substring(requestedUser.substring(0),requestedUser.indexOf('</text>'));

// DOESNT WORK var requestedUser = svcOps.substring(svcOps.indexOf('id="user2">')+11); var revisedUser = requestedUser.substring(requestedUser.substring(0),requestedUser.indexOf('</text>'));


I've attached a screenshot of the user1 approval script and below are the XML tags which contain user1/user2 data.

<text visible="[memberSelect1]=&quot;addUser&quot;" mandatory="[memberSelect1]=&quot;addUser&quot;" readonly="false" multiline="false" button="4002" label="Username" id="user1">OCEANIA\SullivanB</text>
<text visible="[memberSelect1]=&quot;addUser&quot;" mandatory="false" readonly="false" multiline="false" button="4004" label="Username" id="user2">OCEANIA\CurryM</text>

Does anyone have any ideas on what i'm doing wrong here?

Thanks in advance for any help!

EDIT:   User2 approval works if i manually define an approver using the below function however does not seem to work as per the attached approval.

vars.$L_approval_role_user = "oceania-sullivanb";

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.