Symantec Identity Management

Expand all | Collapse all

How to autoincrement a number in Login ID field of CA Identity Suite

Jump to Best Answer
  • 1.  How to autoincrement a number in Login ID field of CA Identity Suite

    Posted 08-14-2018 11:12 AM

    Hello everyone,

     

    I have a problem executing a javascript code into a task in CA Identity Suite.

    The idea of the code is display the 1st letter of the first name, 4 char of the first  surname and the 1st letter of the secod surname + the autoincrement number. 

     

    When I execute the code displays me only 1 number. It seems like it is not recognizing the adding task. 

     

    It would be awesome if someone could help me with this problem. 

     

    In addition, i'll share with you the code i text. If someone knows another way to do it in an optimized way please let me know.

    Thank you so much,

    Daniel Hurtado.

     

    importPackage(java.io);

    function handleValidationBeforeSubmission(BlthContext, errorMessage) {

    user = BlthContext.getSubject();
    up = BlthContext.getUserProvider();
    var name= user.getAttribute("%FIRST_NAME%");
    var surname1= user.getAttribute("%LAST_NAME%");
    var surname2= user.getAttribute("%NAME_ALIAS%");
    var num = 1;
    var loginopcion8=true;
    var opcion8= "";

    surname1=surname1.replace(" ","");

     

    while(loginopcion8) {
    num = ++num;

    opcion8= name.substring(0,1) + surname1.substring(0,4) + surname2.substring(0,1) + num;

    opcion8 = opcion8.toLowerCase();

    try {

    loginopcion8 = up.findUser(null,opcion8,imLoginId);

    } catch(NoSuchObjectException) {

    loginopcion8 = null;

    }

    if (loginopcion8 == null)

    {

    user.setAttribute("%LOGIN_ID%", opcion8);

    return true;
    }

    }

    }



  • 2.  Re: How to autoincrement a number in Login ID field of CA Identity Suite
    Best Answer

    Posted 08-14-2018 06:20 PM

    The problem with trying to use BLTH javascript or even a java class as shown in the below link is that it relies on a lookup via the finduser method but you could have multiple tasks executing concurrently in which case both tasks do the finduser method and think they have the unique name generated but that might not be true.

     

    BLTH for UserID creation CA IDM 14.2 

     

    There are other links referenced below which mention that a more robust solution would be something where you are accessing an externalized source (perhaps a database) where you can serialize the requests and guarantee uniqueness.

     

    Generating incremental user id in policy xpress 

     

    Is it possible to increment attribute value by one after particular task? 



  • 3.  Re: How to autoincrement a number in Login ID field of CA Identity Suite

    Posted 08-15-2018 11:40 AM

    Thank you Kenny,

    Maybe do you know the right method to do the loginid search instead of the userid search?

    Regards.



  • 4.  Re: How to autoincrement a number in Login ID field of CA Identity Suite

    Posted 08-16-2018 10:19 AM

    You should download the JavaDoc for the version of IM you are using (below link is for version 14.2)

    CA Identity Manager Programming Reference - CA Identity Manager - 14.2 - CA Technologies Documentation 

     

    You can then review the UserProvider interface to see the available methods. Perhaps the findusers method is what you need to use so you can provide a User search filter.