syntax to create managed user using java script or groovy

This topic has 2 replies, 2 voices, and was last updated 6 years, 5 months ago by praveenalla.

  • Author
    Posts
  • #7113
     praveenalla
    Participant

    Hi,

    I want to create a managed user on postCreate event of a agency managed object that I created. Can someone share syntax in javascript or groovy script to create a managed user with some values ?

    I want to use the agency value in the user creation as one of the paramters so the 2 managed objects will be related.

    Thanks in advance,
    Praveen

    #7114
     laurent.bristiel
    Participant

    You can do something like that (in JavaScript):

    openidm.create('managed/user','bill',{'userName':'YourUser', 'givenName':'john', 'sn':'doe', 'mail':'[email protected]', 'telephoneNumber':'555-123-1234', 'password':'secured', 
    'description':'User created via script', 'agency':object.agency_name});

    Here, the “agency” property of the user is filled with “agency_name” property of the “agency” object you were creating when onCreate was called.

    Reference:
    openidm.create()
    onCreate Trigger

    #7129
     praveenalla
    Participant

    Thank you very much for your response. I am able to do what I want using the syntax you provided above. I very much appreciate your timely help.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?