How to create role name from 2 different LDAP attributes

I have special requirements for user group/role names, where I need to concatenate 2 different LDAP attributes into the group/role name. Example:

"roles": [
  "<string><LDAP attribute 1><string><LDAP attribute 2>",
  "organization:ORGANIZATION;department:DEPARTMENT
]

Of course I’m able to create mapper/LDAP filter, which will return list of LDAP attribute 1 and LDAP attribute 2. But I’m struggling how to concatenate them into desired format. Any idea how to write it? Maybe some example how to use mapper scripts?

Thx. I didn’t find how can I get user roles from ldap. My scripted mapper:

LDAPQueryConditionsBuilder = Java.type("org.keycloak.storage.ldap.idm.query.internal.LDAPQueryConditionsBuilder");
LDAPUtils = Java.type("org.keycloak.storage.ldap.LDAPUtils");
StorageManager =  Java.type("org.keycloak.storage.UserStorageManager");
var PROVIDER_ID = "<ID>"; // ldap authentication component/provider id in realm
var userStorage = StorageManager.getStorageProvider(keycloakSession, realm, PROVIDER_ID);
var ldapQuery = LDAPUtils.createQueryForUserSearch(userStorage, realm);
var conditionsBuilder = new LDAPQueryConditionsBuilder();
var userDNCondition = conditionsBuilder.addCustomLDAPFilter("(&(|(objectclass=inetOrgPerson)(objectclass=organizationalPerson))(uid=USERID))");
ldapQuery.addWhereCondition(userDNCondition);
var forEach = Array.prototype.forEach;
forEach.call(ldapQuery.getResultList(), function(ldapObject) {
  print(ldapObject);
});

prints only my details, but not my roles from LDAP. How can I get LDAP roles list in the script mapper?