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;
}

Hi Noozan,

Welcome to DUG.

I think this is the first ever questions about the new Report Extensions! [emoticon:c4563cd7d5574777a71c318021cbbcc8] Personally I’ve never tried using them yet.

Your code as such is not wrong, it would work fine, I would just make it look a little better (simpler).

if not UserInfo.Get(userID) then
  exit('');
exit(UserInfo."Full Name");

thank you very much.

so, basically how to get the related record field from another table to report

Yes, you get a related record field from another table in the same way as you get the users full name.

I’m using similar code on a Page, but it seems as if the User cannot be found by it’s SID - does your code really work?

Yes the code does work, but not with the SID, only with the userid.
Also notice SID is only used with Windows logins, not NavUserPassword or the cloud default Azure AD.