How to know if a value is user or group? And after knowing how to get User/Group details?

Hello Everyone,

I am creating a Web API (GET method) and am using a!queryprocessAnalytics to get some values from a report. One of the column in the report is Asignee and the type/Formatting for this column is 'User or Group Name'.

When i test the request i am getting a valid result but with either Group Id or username. I want to first know if the value is User or Group then convert it into First Name, Last name for User or Group name for Group.

I tried using find("[",cast(3,value),0) to know if the value is user or group but after knowing i am not able to convert the value to First Name, Last name for User or Group name for Group.

Please help me to find a solution for this.

Thank you

  Discussion posts and replies are publicly visible

Parents
  • A technique I usually use for this sort of thing (particularly pertaining to using portal reports, which still utilize lots of legacy-style coding practices and restrictions in the back-end that aren't well explained anywhere "officially"), is to create additional columns in the report itself to help with this.  For instance, I'll create a column called "assignmentString" which wraps the task_assignee_owner() report property in tostring().  This causes group assignment values to render as "[Group:55]" etc, where the "55" here represents the Group ID.  User assignments render as regular (username) strings.  Using this method it's then easy to parse which is which and display values appropriately.  It also allows for easier filtering from a SAIL form.  To see a working demonstration of some of these things, please feel free to download my "Advanced User Task Report" app available in the App Market.

Reply
  • A technique I usually use for this sort of thing (particularly pertaining to using portal reports, which still utilize lots of legacy-style coding practices and restrictions in the back-end that aren't well explained anywhere "officially"), is to create additional columns in the report itself to help with this.  For instance, I'll create a column called "assignmentString" which wraps the task_assignee_owner() report property in tostring().  This causes group assignment values to render as "[Group:55]" etc, where the "55" here represents the Group ID.  User assignments render as regular (username) strings.  Using this method it's then easy to parse which is which and display values appropriately.  It also allows for easier filtering from a SAIL form.  To see a working demonstration of some of these things, please feel free to download my "Advanced User Task Report" app available in the App Market.

Children