This topic has 1 reply, 2 voices, and was last updated 1 year, 8 months ago by Bill Nelson.

  • Author
  • #28431

    I thought I would share this as it has been working for me and easing getting workflow running in IDM.

    So this knowledge article was the key for me getting this working:
    Here how I get IntelliJ (should work with eclipse) to break and allow me to single step, examine variables… in scriptTask and userTask.

    I get IDM to listen on 5005 by adding this to the JPDA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

    To debug a scriptTask, I set the task to this:

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    def logger = LoggerFactory.getLogger("logger");
    File scriptFile = new File("script/NewUserWorkflow.groovy");
    Class groovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(scriptFile);
    GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(runtimeService: runtimeService, execution: execution, openidm: openidm);
    String retVal = groovyObject.variableDefinition();" ***** variabledefinition: " + retVal);

    In my script directory, I have a groovy class in NewUserWorkflow.groovy script file.

    The script task creates a new instance of the class and pass in the runtimeService, execution, openidm objects.

    My script has a method called variableDefinition where I do some rest queries and set execution variables.

    Looks like this and is called via reflection in the scriptTask:

    String variableDefinition() {
        try {
            def fields = ['*'];
            def registrationId = execution.getVariable("registrationId");
            String registrationPath = "managed/registration/" + registrationId;
            def registrationUser =, null, fields);
            def userQuery = ["_queryFilter": createSimpleQuery("userName", "eq", registrationUser.authorizer)];
            def startUserFromRepo = openidm.query("managed/user", userQuery, fields);
            if (startUserFromRepo.result.size() != 1) return false;
            def startUser = startUserFromRepo.result[0];
            execution.setVariable("authorizer", registrationUser.authorizer);
            execution.setVariable("registrationUser", registrationUser);
            execution.setVariable("uid", registrationId);
            execution.setVariable("userFullName", String.format("%s, %s",, registrationUser.givenName));
            execution.setVariable("startUser", startUser);
            return "true";
        catch (Exception ex) {
        return "false";

    Then just attach the IDE to 5005 and set break points. Fire off the workflow. The IDE will break and let you take a look around.


     Bill Nelson

    Great contribution to the group, Gene. Thank you for sharing!~

Viewing 2 posts - 1 through 2 (of 2 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?