web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Personalization using X++

(0) ShareShare
ReportReport
Posted on by 390

Hey Team,

I wanted to know if we can add some personalization files to a particular user without FormRunConfigurationClass. I mean without using a form can we add some personalization files to a user using x++.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Personalization is a way to modify the user interface without development, according to the user's preferences.

    If you are anyway going to develop code, are you sure you want to have your code output personalizations instead of actual modifications on the form itself?

    Also, are you familiar with the new Saved views functionality?

    docs.microsoft.com/.../saved-views

  • skd Profile Picture
    390 on at

    Hey Nikolaos Mäenpää ,

    Actually I have very little knowledge regarding personalization so I don't much about this but my company has a requirement where we have some custom personalization files which when we create an associate should directly get attached to that particular associate so therefore I wanted to know can we achieve it without FormRunConfigurationClass.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can copy personalization from one user to another in x++ : dhruvrthakar.blogspot.com/.../x-code-to-copy-users-settings-from-one.html

    The blog illustrates how to copy all personalization, but it's possible to copy personalization of some objects, too. You can select SysLastValue based on ElementType and ElementName.

    You were talking about personalization files. This is already possible using the out of the box dialog. Why is this dialog not good for you? Would you like to develop a new dialog? Or read the files automatically from somewhere? You need to remember that D365FO is a cloud service and can't read any files from your company's fileshares or your local computer. So, if you need to assign these personalizations programmatically, I suggest to rather copy them from an existing user, and forget the file based approach if possible.

    But of course it is possible to store the files in some cloud service such as OneDrive and write x++ code to read them from therre.

  • skd Profile Picture
    390 on at

    Hey Nikolaos Mäenpää ,

    Actually I think I haven't explained somethings in detail and therefore it is causing confusion so I'll explain everything in detail so you can suggest me if I'm right.

    Whenever we create an associate we go the personalization and select user. Here, we have a custom button called 'Import' which when clicked opens a dialogue form where we select the user and all the personalization files present which we select and then on clicking the 'OK' button these files are added to that associate so this particular functionality I want it via x++ without explicitly adding it through the dialogue. To create an associate I'm running a batch job  which creates an associate and populates multiple tables and I want to add these personalisation diles through that batch job itself. I code which is present in this functionality uses FormRunConfigurationClass for many things  and therefore I wanted to know if it can be achieved without using a form. I will attach the screenshot of what is happening. Please let me know should I share the code of that function if you can then help me achieve this

    Personlization1.png

    Personalization-3.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    I still suggest to copy the personalizations from another user. This is the easiest approach. You could even have some dummy/template user for this, and keep it disabled. In this case the user would not cause any license cost as far as I understand.

    If it's not feasible, then you need to break your problem into smaller ones.

    1. Import personalization file in batch

    2. Apply personalization file to user in x++

    For the first one, just search the web for how to import files programmatically to D365FO.

    For the second one, I think you need to study how the standard, form based functionality is implemented, and then try to implement similar solution without having dependency to the form.

    Also in general, if you want to apply some form customization to all users that are created, I suggest to rather change the forms via development! It could be even cheaper than building all these integrations (of course depending on the complexity and amount of personalizations).

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Additionally, I already mentioned the new Saved views functionality. This would allow you to have many different designs/"personalizations" on the same form and show different versions to different users.

  • skd Profile Picture
    390 on at

    Hey Nikolaos Mäenpää,

    Thank you so much will work on this and update you accordingly if I need any help thank you so much.

  • skd Profile Picture
    390 on at

    Hey Nikolaos Mäenpää,

    I tried the code for demo which you gave me regarding the copy personalization from one user to another but in that I'm facing some issue. When I copy the personalization from one user to another only one file is copied also when I try to view the personalization for that particular associate it doesn't show. Can you pls help me understand why is this happening.

    Code I used:

    static void CopyUserSettings(Args _args)
    {
        Dialog          dialog = new Dialog("Copy user settings");
        DialogField     fldFromUser, fldToUser;
        UserId          fromUser, toUser;
        SysLastValue    sysLastValue;
        int             counter = 0;
    
        fldFromUser = dialog.addField(extendedTypeStr(UserId), "From user", "The user to copy settings from");
        fldToUser = dialog.addFieldValue(extendedTypeStr(UserId), curUserId(), "To user", "The user to copy settings to");
    
        dialog.run();
        dialog.wait();
        if (dialog.closedOk())
        {
            fromUser = fldFromUser.value();
            toUser = fldToUser.value();
    
            if (SysUserInfo::find(fromUser).RecId && SysUserInfo::find(toUser).RecId && fromUser != toUser)
            {
                if (Box::yesNoCancel(strFmt("Delete all user settings for %1?", toUser), DialogButton::Cancel) == DialogButton::Yes)
                {
                    info(strFmt("Copying user settings from %1 to %2", fromUser, toUser));
                    ttsBegin;
    
                    delete_from sysLastValue where sysLastValue.userId == toUser;
    
                    while select sysLastValue where sysLastValue.userId == fromUser
                    {
                        sysLastValue.userId = toUser;
                        sysLastValue.insert();
                        counter  ;
                    }
    
                    ttsCommit;
                    info(strFmt("%1 records copied from %2 to %3", counter, fromUser, toUser));
                }
                else
                {
                    info("Copy canceled");
                }
            }
            else
            {
                throw error("Invalid / non existing users or same user selected for copy action");
            }
        }
        else
        {
            info("Copy canceled");
        }
    }

    This is user I'm copying the personalization from:

    Abdul-1.png

    Abdul-2.png

    Holly-owen.png

    holly-2.pngHolly-final.png

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Hi skd,

    You are copying details from the table SysLastValue. The form configurations are not stored in this table, but the table FormRunConfiguration.

    You are aware that you can already copy the form Personalizations on the 'Apply' tab page?

  • skd Profile Picture
    390 on at

    Hey André Arnaud de Calavon ,

    I'm new to this so I'm not very sure about it. Can you please elaborate as how can I achieve my task or rather what code changes can I make to copy the personalization from one user to another.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans