IBM Verify

IBM Verify

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Email Notification

    Posted Tue April 20, 2021 07:58 AM

    Hello,

    I'd like to create email notification in workflow process, it should be working like this: After create account, there is email sent, which is send to Manager of user (of course if user doesn't have an email address) and for users which have this role "ITIM Administrators" I know I can do this as 2 processes but I want only one email sended to all this users

    I've created this code, but it doesn't work like I want, maybe someone can help me? Maybe I made a mistake someplace

    var role = addedRole.get(); var multiParticipants = new Array(); var ownerObj = owner.get(); var mailId = ownerObj.getProperty("mail")[0]; var roleOwners = role.getProperty("ITIM Administrators"); //for (i = 0; i < roleOwners.length; i++) { //multiParticipants.add[0] = new Participant(ParticipantType.USER, roleOwners[i]); multiParticipants.add(new Participant(ParticipantType.USER, roleOwners)); if((mailId != null) && (mailId != "") && (mailId.length > 0) && (typeof mailId != 'undefined')) { var ownerdn = ownerObj.getProperty("owner")[0]; multiParticipants.add(new Participant(ParticipantType.USER, ownerdn)); } else { var managerdn = ownerObj.getProperty("manager")[0]; //var managerrb = ownerObj.getProperty("cfmanagerrb")[0]; multiParticipants.add(new Participant(ParticipantType.USER, managerdn)); //activity.auditEvent("Użytkownik nie posiada adresu mailowego, nowe hasło zostanie przesłane do jego przełożonego:" + managerrb); } return multiParticipants;

    #Support
    #SupportMigration
    #Verify


  • 2.  RE: Email Notification

    Posted Tue April 20, 2021 12:24 PM

    Hi Artur...

    You may need to clarify a few things in order for anyone to weigh in here.

    What do you mean when you say "it doesn't work like I want"....are you seeing errors? Is it technically working, but not doing exactly what you're looking for (if so, you should state what it's doing and how this is different than what you're expecting)?

    As far as your script goes...

    • what is contained in the "addedRole" Relevant Data Item you're referencing in the first line (and how are you populating that Relevant Data Item)?
    • in your 4th line, you're assuming there is a value for "mail" since you're directly trying to access the 0 index of the Array. If a user doesn't have a "mail" attr value, then this line will throw an error...so you might want to adjust that to just return the Array, then in your "if" statement later in the script you can check against the Array and return the 0 index if not null/zero length, or undefined.
    • your 5th line won't work...there is no attribute or relationship on Role objects called "ITIM Administrators", so you can't execute .getProperty("ITIM Administrators")...what are you trying to do here?


    #Support
    #SupportMigration
    #Verify


  • 3.  RE: Email Notification

    Posted Tue April 20, 2021 12:33 PM

    Let me add a comment - although I very much like to go to borders (and sometimes over) of what ISIM is designed for I also recommend the KISS principle - so if you can do it with much less scripting with 2 operations - why not stick to that ?

    I will bet there is a larger risk of doing a complex script than whatever downside you see in doing it twice with much less code - and it will also be much more clear what you are actually doing in the workflow...

    Regards

    Franz Wolfhagen



    #Support
    #SupportMigration
    #Verify


  • 4.  RE: Email Notification

    Posted Wed April 21, 2021 06:15 AM

    Hello,

    Thank you for your answers, , it was created as a simple two operations of sending notification - one email for manager and one email for administrators but supplier want to receive less emails and as an administrator want to see to who email is send, because sometimes email didn't came to manager and in logs there is no message why didn't came.

    's working as I want :)

    Here is the correct code:

    //var role = addedRole.get(); var multiParticipants = new Array(); var ownerObj = owner.get(); var mailId = ownerObj.getProperty("mail")[0]; //var roleOwners = role.getProperty("ITIM Administrators")[0]; multiParticipants[0] = new Participant(ParticipantType.USER, "erglobalid=7415940384582509432,ou=0,ou=people,erglobalid=00000000000000000000,ou=cfp,DC=PL"); //activity.auditEvent("Dodano mail admin ITIM: " + roleOwners); if((mailId != null) && (mailId != "") && (mailId.length > 0) && (typeof mailId != 'undefined')) { //activity.auditEvent("Uzytkownik ma mail: " + mailId); var ownerdn = ownerObj.getProperty("owner")[0]; multiParticipants[1] = new Participant(ParticipantType.USER, ownerdn); } else { var managerdn = ownerObj.getProperty("manager")[0]; var managerrb = ownerObj.getProperty("cfmanagerrb")[0]; multiParticipants[1] = new Participant(ParticipantType.USER, managerdn); activity.auditEvent("User doesn't have an e-mail address, a new password will be sent to his supervisor: " + managerrb); } return multiParticipants;

    And now email is sending to manager of user and administrator (to erglobalid of user I added group email of administrators)



    #Support
    #SupportMigration
    #Verify