How to add dynamic custom text to journey choice nodes

Want to add a journey choice collector node that allows users to decide which second factor to use (authenticator or a call/text push) and want the call/text push choice to display the user’s phone number from idm.

I don’t think we can do this with the default choice collector node. However, this should be possible with a scripted node. You can make use of the Choice Callback and return whatever you need to the user.


var fr = JavaImporter(
    org.forgerock.openam.auth.node.api.Action,
  javax.security.auth.callback.ChoiceCallback

)
if (callbacks.isEmpty()) {
  //new fr.ChoiceCallback("Choose your method",[sharedState.get("objectAttributes").get("telephoneNumber"),"No"],1, false
    action = fr.Action.send(
       new fr.ChoiceCallback("Choose your method",
                             ["Text message to " + sharedState.get("objectAttributes").get("telephoneNumber"),"FIDO","Push Notification"],
                             1,
                             false)).build()
}
else {
  if(callbacks.get(0).getSelectedIndexes()[0] === 0){
  action = fr.Action.goTo("SMS").build();
} else if (callbacks.get(0).getSelectedIndexes()[0] === 1){
  action = fr.Action.goTo("FIDO").build();
} else {
  action = fr.Action.goTo("Push").build();
}}

This would get you a prompt similar to this
image

Then you can branch out your tree based on the outcome
image

5 Likes