Is there a way to sort users by their first or last names instead of their user Ids?

A Score Level 1

Is there a way to sort users by their first or last names on reports instead of their user Ids?
Whenever I try to convert a user into text to display via user(pv!user, 'firstName') the data returns blank....


  Discussion posts and replies are publicly visible

  • The user function is one of the Appian Scripting Functions which is not supported for use on the report. This is indicated here:

    An enhancement request is in place to allow to use these in reports -- AN-43174.

    In order to show (and ultimately sort0 data derived from the Appian Scripting Functions, then you must run these expressions in the process and save the output to variables which you can use in the reports.
  • Ah - many thanks for the answer Michael.
  • This will solve the problem, but it doesn't scale too well for sorting large numbers of users (>150).

      local!datasubset: todatasubset(
        arrayToPage: a!forEach(
          items: ri!users,
          expression: {
            username: tostring(fv!item),
            firstName: if(ri!sortBy = "firstName",user(fv!item,"firstName"),""),
            lastName: if(ri!sortBy = "lastName",user(fv!item,"lastName"),"")
        pagingConfiguration: a!pagingInfo(
          startIndex: 1,
          batchSize: -1,
          sort: a!sortInfo(
            field: ri!sortBy,
            ascending: ri!ascending