You create a class file in your App_Code Directory. I call this one CustomFunctions.cs
You then call the function in your transformation as CustomFunctions.GetUserDescription("Put or get UserID Here")
Here is the complete class. Just create the file name above and paste this code into it. Or if you have a custom function class file already just past the code. Make sure your usings are correct.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using CMS.Helpers;
using CMS.Controls;
using CMS.EventLog;
using CMS.TreeEngine;
using CMS.DocumentEngine;
using CMS.ExtendedControls;
using CMS.PortalEngine;
using CMS.SettingsProvider;
using CMS.UIControls;
using CMS.SiteProvider;
using CMS.Membership;
using CMS.MembershipProvider;
using CMS.Protection;
/// <summary>
/// Custom Functions for Site.
/// </summary>
public class CustomFunctions
{
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;
}
}