Highlighted
Absent Member.
Absent Member.
1292 views

IDVault.get multivalued attribute


Due to the complex environment here, I'm trying to look up a group
object, read an attribute, depending on its value look at other
attributes on the group (member / owner), then look up each required
member / owner for their email address. At any stage, the attribute may
or may not exist.

I can read the multivalued attributes (member / owner), but every loop
solution I use gives me grief....

Source ECMA (with some things **** for redaction):


Code:
--------------------
try
{
var notifMembers = IDVault.get(objectDN, '****Group', 'Member');
trace("findNotificationEmails(): notifMembers " + notifMembers.toString(), 3);
if ((notifMembers != undefined) && (notifMembers != null))
{
for (var m in notifMembers)
{
trace("findNotificationEmails(): Find Email Addresses for " + notifMembers, 3);
try
{
var notifEmailAddress = IDVault.get(notifMembers, '****User', 'InternetEMailAddress');
trace("findNotificationEmails(): notifEmailAddress " + notifEmailAddress, 3);
if ((notifEmailAddress != undefined) && (notifEmailAddress != null) && (notifEmailAddress != ""))
{
toaddresses.push(notifEmailAddress);
}
}
catch(e)
{
trace("findNotificationEmails(): Error " + e, 1);
}
}
}
}
catch(e)
{
}
--------------------


The trace outputs:


Code:
--------------------
2016-02-29 13:47:43,282 [****] findNotificationEmails()
2016-02-29 13:47:43,282 [****] findNotificationEmails(): objectDN cn=*********,ou=*********,ou=*********,o=*********
2016-02-29 13:47:43,287 [****] findNotificationEmails(): mailTarget MEMBER
2016-02-29 13:47:43,289 [****] findNotificationEmails(): Error TypeError: Cannot read property "toString" from null
2016-02-29 13:47:43,291 [****] findNotificationEmails(): notifMembers [cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities, cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities, cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities]
2016-02-29 13:47:43,291 [****] findNotificationEmails(): Find Email Addresses for false
2016-02-29 13:47:43,291 [****] findNotificationEmails(): Error JavaException: com.novell.soa.af.ProvisioningException: Identifier [false] does not exist for this service operation.
--------------------


Why the flock am I only ever getting "false" as a loop value??


--
-"Also now available in 'G+'
(http://plus.google.com/+BenWalter-Kiwi) and 'Website'
(https://www.isam.kiwi/) format".- 😉
------------------------------------------------------------------------
ScorpionSting's Profile: https://forums.netiq.com/member.php?userid=469
View this thread: https://forums.netiq.com/showthread.php?t=55446


Visit my Website for links to Cool Solution articles.
Labels (1)
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


Code:
--------------------
for (var m = 0; m < notifMembers.length; m++)
--------------------


gives me nothing.


Code:
--------------------
for each (var m in notifMembers)
--------------------


gives me nothing.

Was looking at some other ECMA loop functions (i.e. for...of..., etc),
but it appears the ECMA Engine in User App is ancient and won't cope
with a lot of functional calls.


--
-"Also now available in 'G+'
(http://plus.google.com/+BenWalter-Kiwi) and 'Website'
(https://www.isam.kiwi/) format".- 😉
------------------------------------------------------------------------
ScorpionSting's Profile: https://forums.netiq.com/member.php?userid=469
View this thread: https://forums.netiq.com/showthread.php?t=55446


Visit my Website for links to Cool Solution articles.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


I ended up doing this to create a proper Array object:


Code:
--------------------
var notifMemberArray = notifMembers.toString().replace(/\[/g,"").replace(/\]/g,"").split(", ");
--------------------


Then I was able to loop through with:


Code:
--------------------
for (var m = 0; m < notifMemberArray.length; m++)
--------------------


:mad: :mad:


--
-"Also now available in 'G+'
(http://plus.google.com/+BenWalter-Kiwi) and 'Website'
(https://www.isam.kiwi/) format".- 😉
------------------------------------------------------------------------
ScorpionSting's Profile: https://forums.netiq.com/member.php?userid=469
View this thread: https://forums.netiq.com/showthread.php?t=55446


Visit my Website for links to Cool Solution articles.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


ScorpionSting;265591 Wrote:
> Due to the complex environment here, I'm trying to look up a group
> object, read an attribute, depending on its value look at other
> attributes on the group (member / owner), then look up each required
> member / owner for their email address. At any stage, the attribute may
> or may not exist.
>
> I can read the multivalued attributes (member / owner), but every loop
> solution I use gives me grief....
>
> Source ECMA (with some things **** for redaction):
>
> >

Code:
--------------------
> > try

> {
> var notifMembers = IDVault.get(objectDN, '****Group', 'Member');
> trace("findNotificationEmails(): notifMembers " + notifMembers.toString(), 3);
> if ((notifMembers != undefined) && (notifMembers != null))
> {
> for (var m in notifMembers)
> {
> trace("findNotificationEmails(): Find Email Addresses for " + notifMembers, 3);
> try
> {
> var notifEmailAddress = IDVault.get(notifMembers, '****User', 'InternetEMailAddress');
> trace("findNotificationEmails(): notifEmailAddress " + notifEmailAddress, 3);
> if ((notifEmailAddress != undefined) && (notifEmailAddress != null) && (notifEmailAddress != ""))
> {
> toaddresses.push(notifEmailAddress);
> }
> }
> catch(e)
> {
> trace("findNotificationEmails(): Error " + e, 1);
> }
> }
> }
> }
> catch(e)
> {
> }

--------------------
> >

>
> The trace outputs:
>
> >

Code:
--------------------
> > 2016-02-29 13:47:43,282 [****] findNotificationEmails()

> 2016-02-29 13:47:43,282 [****] findNotificationEmails(): objectDN cn=*********,ou=*********,ou=*********,o=*********
> 2016-02-29 13:47:43,287 [****] findNotificationEmails(): mailTarget MEMBER
> 2016-02-29 13:47:43,289 [****] findNotificationEmails(): Error TypeError: Cannot read property "toString" from null
> 2016-02-29 13:47:43,291 [****] findNotificationEmails(): notifMembers [cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities, cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities, cn=*********,ou=*********,ou=Active,ou=Workforce,o=Communities]
> 2016-02-29 13:47:43,291 [****] findNotificationEmails(): Find Email Addresses for false
> 2016-02-29 13:47:43,291 [****] findNotificationEmails(): Error JavaException: com.novell.soa.af.ProvisioningException: Identifier [false] does not exist for this service operation.

--------------------
> >

>
> Why the flock am I only ever getting "false" as a loop value??

On the WF side IDVault.get returns either null if there is no such an
attribute or string if there is only one value or java.util.ArrayList if
there are more than one value.
So to iterate through multiple values you could use .get(index) and
..size() methods. It can be something like this:

Code:
--------------------
var values = [];
var value = IDVault.get(...);
if (value != null) {
// multivalue attribute has only one element
if (typeof value === "string") {
values.push(value);
}

// multivalue attribute has more than one element. It's actually java.util.ArrayList
if (typeof value === "object") {
for (var i = 0, size = value.size(); i < size; i++) {
values.push(value.get(i));
}
}
}
// multivalue attribute has no values
else {
// NOP
}
--------------------


--
hello_amigo
------------------------------------------------------------------------
hello_amigo's Profile: https://forums.netiq.com/member.php?userid=211
View this thread: https://forums.netiq.com/showthread.php?t=55446

Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


Thanks!

Possible to get that added to the IDVault.get documentation?


--
-"Also now available in 'G+'
(http://plus.google.com/+BenWalter-Kiwi) and 'Website'
(https://www.isam.kiwi/) format".- 😉
------------------------------------------------------------------------
ScorpionSting's Profile: https://forums.netiq.com/member.php?userid=469
View this thread: https://forums.netiq.com/showthread.php?t=55446


Visit my Website for links to Cool Solution articles.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


ScorpionSting;265663 Wrote:
> Thanks!
>
> Possible to get that added to the IDVault.get documentation?

I would like it to be documented as well. However I don't have influence
on that.


--
hello_amigo
------------------------------------------------------------------------
hello_amigo's Profile: https://forums.netiq.com/member.php?userid=211
View this thread: https://forums.netiq.com/showthread.php?t=55446

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute


Steven,

Can we get the code snippet added as an example to
http://tinyurl.com/j4hv2aq ???


Code:
--------------------
var values = []; var value = IDVault.get(...);
if (value != null) {
// multivalue attribute has only one element
if (typeof value === "string") {
values.push(value);
}

// multivalue attribute has more than one element. It's actually java.util.ArrayList
if (typeof value === "object") {
for (var i = 0, size = value.size(); i < size; i++) {
values.push(value.get(i));
}
}
}
// multivalue attribute has no values
else {
// NOP
}
--------------------


--
-"Also now available in 'G+'
(http://plus.google.com/+BenWalter-Kiwi) and 'Website'
(https://www.isam.kiwi/) format".- 😉
------------------------------------------------------------------------
ScorpionSting's Profile: https://forums.netiq.com/member.php?userid=469
View this thread: https://forums.netiq.com/showthread.php?t=55446


Visit my Website for links to Cool Solution articles.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: IDVault.get multivalued attribute

ScorpionSting wrote:

>
> Steven,
>
> Can we get the code snippet added as an example to
> http://tinyurl.com/j4hv2aq ???



FYI: I've submitted this as document feedback for this page with a
reference/link to this thread.
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.