Getting group membership of users in the Forgerock Identity Cloud

Hello,
I’ve a use case in a journey to branch out based on the group membership of a user. In Platform AM, it is done using a scripted decision node with code resembling the following:

var groups = idRepository.getAttribute(username, “isMemberOf”).toString();

if (idRepository.getAttribute(username, attribute).toArray()[0].contains(“special”))
outcome = “special”;

I’m wondering what’s the equivalent way to do the above in Identity Cloud?

From the user’s Raw JSON, I see his group as follows:

"effectiveGroups": [
    {
      "_refResourceCollection": "managed/alpha_group",
      "_refResourceId": "Dev Group",
      "_ref": "managed/alpha_group/Dev%20Group"
    }
  ],

Anyone has done similar things in Identity Cloud? If yes, any help would be greatly appreciated.

Thanks!

hi @mtuhin
In AIC, you can use the next-gen script. With these new scripts you have access to idm bindings and you can use one of these function to get the user groups.
But you can still use idRepository function since it’s still part of the bindings : Scripted decision node API :: ForgeRock Identity Cloud Docs
regards,
Steph.