Starting selfservice process from script fails

This topic has 2 replies, 2 voices, and was last updated 3 months, 3 weeks ago by Henk Schouten.

  • Author
  • #28308
     Henk Schouten


    I am trying to build a script that will start a selfservice process for account activation. It will be called for newly created users only. I have setup an activation process that I can run stage by stage using REST calls. But when I try to run it from a script it fails with a null pointer exception coming from the sendEmail stage that tries to obtain the subject and message translations. It seems that when being called from a script by using the openidm.action function it does not have a context providing Locales information.

    Is there a way to provide for instance “Accept-Language” header when using the openidm.action function?

    I have considered using an external/rest call for this purpose, since this seems to provide the possibility to add headers to the request. But it seems ugly to call an openidm service from an openidm script by taking the external route. It also would require authentication which would also make things more complex.

    Are there any other options to achieve this?

    Thanks in advance!

    Best Regards
    Henk Schouten


    Part of stacktrace of the exception thrown:
    Oct 01, 2020 6:22:47 PM org.forgerock.selfservice.core.AnonymousProcessService logAndAdaptException
    SEVERE: Exception intercepted
    	at org.forgerock.selfservice.stages.utils.LocaleUtils.getTargetLocales(
    	at org.forgerock.selfservice.stages.utils.LocaleUtils.getTranslationFromLocaleMap(
    	at org.forgerock.selfservice.core.AnonymousProcessService.renderRequirementsWithSnapshot(
    	at org.forgerock.selfservice.core.AnonymousProcessService.enactContext(
    	at org.forgerock.selfservice.core.AnonymousProcessService.handleProgression(
    	at org.forgerock.selfservice.core.AnonymousProcessService.enactContext(
    	at org.forgerock.selfservice.core.AnonymousProcessService.progressProcess(
    	at org.forgerock.selfservice.core.AnonymousProcessService.handleAction(
    	at org.forgerock.openidm.selfservice.impl.SelfServiceProcessHandler.handleAction(
    	at org.forgerock.json.resource.Router.handleAction(
     Jake Feasel

    Unfortunately, your “ugly” solution is pretty much the only one available. There is a similar example available within one of the workflows provided OOTB in contractorOnboarding.bpmn20.xml:

                // Automatically send the user a password reset email
                // Current limitation with supplying locale via http headers requires the call to be made via http
                openidm.action("external/rest", "call", [
                    "url": "https://localhost:"+identityServer.getProperty('openidm.port.https')+"/openidm/selfservice/reset?_action=submitRequirements",
                    "method": "POST",
                    "headers": [
                        "Content-Type": "application/json",
                        "X-OpenIDM-Username": "anonymous",
                        "X-OpenIDM-Password": "anonymous",
                        "Accept-Language": "en-US,en"
                    "body": '{"input": {"queryFilter": "/userName eq \\\"' + newUserFromRepo.result[0].userName.replace(/"/, "\\\"") + '\\\""}}'
     Henk Schouten

    Hi Jake,

    Thanks for your quick response. Considering the comments in the onboardingContractor example I think you are right. So I will implement it that way then.

    Thanks again.


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

You must be logged in to reply to this topic.

©2021 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?