Handling Form Queries with IDM UserApp

By: rduym

June 20, 2007 3:06 am

Reads: 176




A Forum reader recently asked:

“On a event, I’m doing a query for a user object. If the query does not return an empty string, I want to put a form.alert. The query looks like this:

var v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});

How do I check for the return to be non-empty and the user to get the function form alert?”

And here’s the response from Rudy Duym …


This expression:

var v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});

returns an array with 2 entries, each being also an array of values. The result will also be stored in the field “idesist”, which corresponds to the first parameter value.

The first entry on the array contains the dn values returned by the query. You get the first value of this array with a v[0][0]. You can also loop over the values, of course.

The second entry contains the cn part of the dn values returned by the query. You get the first value of this array with a v[1][0].

So if you want to test whether a non-empty value was returned, you can use something like this:

      var v = "";
      try {
        v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});      
      } catch (e) {};
      if (v.length > 0 && v[0].length > 0 && v[0][0] != "") {
       // non empty result

Note: As a field destination is specified, the result of the query will also be automatically stored in the field “idesist”!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Categories: Identity Manager, Technical Solutions

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.