Display the roles in a Multi line

Community Alums
Not applicable

Hello,

How to display the current roles of the user using multiline on a catalog item. When user is selected it will automatically show the current roles of the user.

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi @Community Alums 

please provide the script & configurations for the "Roles" field

Maik

Community Alums
Not applicable

Hello @Maik Skoddow,

Currently I'm configuring the script. 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

    var traineeSysID = g_form.getValue('requested_for');
    
    if (!traineeSysID) {
        return;
    }

    var traineeRoleCollection = getUserRoles(traineeSysID);

    g_form.setValue('roles_user', traineeRoleCollection.join);
}

 

Hi @Community Alums 

 

as you did not provide the code for the method getUserRoles() I only can guess what's built there.

 

However, the line

g_form.setValue('roles_user', traineeRoleCollection.join);

seems to be wrong.

 

Please try instead:

g_form.setValue('roles_user', traineeRoleCollection.join('\n');

 

Maik