How to get the newly created user id with in the registration journey?

I have a customised journey for user registration, until registering the user is working. Now I wanted to get the newly created user ID and sent a notification to an external system. But struggling to get the newly created user’s UUID(fr-idm-uuid).

I was trying to get the the uuid using the userName like idRepository.getAttribute(String userName, String attributeName) this, it is giving no response when passing user name for the first parameter. But giving the attributes when passing uuid in place of user like idRepository.getAttribute(String uuid, String attributeName).

I have all other details of the newly created user in the scripted node right after the ‘Create Object’ node, but not the uuid. Anybody can help me to get the uuid to the scripted decision node?

Hello @sakkeer-roshn,

Welcome to the Community!

For your inquiry on retrieving UUID, have you reviewed the following Knowledge Base article on how to achieve this in Identity Cloud:

Alternatively, for on-prem environments, one of our Engineers has provided a different method to include the UUID for the user in the shared state, without having to use the Identity Store Decision node as documented in the above Identity Cloud KB article. His explanation follows:

This was done with the addition of the Identity Existing User node. See the documentation for this below. This node verifies a user exists based on an identifying attribute, such as an userName, then makes the value of a specified attribute available in the shared node state(UUID).

To configure this the node needs to be placed between the Scripted Decision Node and the Data Store Decision Node in the journey. Then configure the node with the values userName and userName for Identifier and Identity Attribute respectively. Please note this is case sensitive.

As before I included the Scripted Decision Node which prints my shared state. Following authentication, the output of this can be seen below:

As you can see the UUID of the user is now available under the attribute _id . This can also be referenced in your script to print entries in the logs, or to be used in the getAttribute method.

var userId = nodeState.get("_id").asString();logger.error(" testlog userId {} ", userId);
{"timestamp":"2024-01-23T11:33:58.371Z","level":"ERROR","thread":"ScriptEvaluator-4","mdc":{"transactionId":"0569fbc1-8eff-40fa-8620-39140d48875b-13101"},"logger":"Get UUID Script testing (46bc0fda-bb33-46d8-99a0-998cb3fd1b27)","message":" testlog userId 07c853d3-af57-4326-9c0a-cb951ab1b4a1 ","context":"default","transactionId":"0569fbc1-8eff-40fa-8620-39140d48875b-13101"}

I hope the information provided helps!

Warm Regards,

1 Like