I want to get SystemCreatedBy user full name in Purchase - Credit Memo report

what is the best way to lookup user table by using SystemCreatedBy and get the user full name.

i prefer using report extension. 

here is my recent code

am I doing it right or is there a better way

reportextension 50102 "Purchase - Credit MemoExt" extends "Purchase - Credit Memo"
{
    dataset
    {
        add("Purch. Cr. Memo Hdr.")
        {
            column(Creted_user_Name; GetFullName(SystemCreatedBy)) { }
            column(Modified_user_Name; GetFullName(SystemModifiedBy)) { }
        }
    }

    requestpage
    {
        // Add changes to the requestpage here
    }
    procedure GetFullName(userID: Guid): Text
    var
        UserInfo: Record User;
    begin
        //UserInfo.Get(userID);
        if UserInfo.Get(userID) then begin
            exit(UserInfo."Full Name");
        end
        else begin
            exit('');
        end;
    end;
}

Related
Recommended