Getting group membership of users in the Forgerock Identity Cloud

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.