How to get User Description based on UserID?

Aashish Khandelwal asked on April 6, 2015 11:08

I have created an Article Type Transformation wherein I wanted to display the description of an user based on userID.

Suggest...

Correct Answer

Aashish Khandelwal answered on February 2, 2016 17:53

{% GlobalObjects.Users[GetUserName(ArticleAuthor)].UserDescription  |(identity)GlobalAdministrator%}

Here ArticleAuthor represents the userID.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Charles Matvchuk answered on April 6, 2015 15:32

You will need to create a custom function. Here is working example.

public static string GetUserDescription(object UserID)
{
    string resolved = string.Empty;
    if (UserID != null)
    {
        int userID;
        if (Int32.TryParse(UserID.ToString(), out userID))
        {
            var user = UserInfoProvider.GetUserInfo(userID);

            if (user != null)
            {
                resolved = user.UserDescription ?? string.Empty;
            }
        }
    }

    return resolved;
}
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.