The below examle is to add the form -Data source level adding display method and assigning to form design control.
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
24 August 2025
25 April 2025
AXmodel file import in D365 F&O
ModelUtil.exe -import -metadatastorepath=k:\aosservice\packageslocaldirectory -file=C:\Temp\DEST.axmodel
10 April 2025
X++ code to get the time and add and substract using the current date time in D365 F&O
utcdatetime dateTime = DateTimeUtil::getSystemDateTime();//DateTimeUtil::utcNow();
utcdatetime newDateTime = DateTimeUtil::addMinutes(dateTime, -20);
Info(strFmt("Current time: %1 redueced Time: %2 ",dateTime,newDateTime));
09 April 2025
X++ code to create new user in D365 F&O
public void createUser(UserId _userId,Name _userName)
{
UserInfo userInfo;
SecurityUserRole userRole,userRoleToSave;
SecurityRole securityRole;
// Step 1: Create new User Info record
ttsBegin;
userInfo.id = _userId;
userInfo.Name = _userName;
userInfo.networkAlias = Xine_UserAcessTable.Email;
userInfo.networkDomain = Xine_UserAcessTable.NetworkDomain;
userInfo.ObjectId = Xine_UserAcessTable.TelemetryId;
userInfo.enable = Xine_UserAcessTable.Enabled;
userInfo.insert(); // Save the user info record
info(strFmt('User created: %1', userInfo.id));
select securityRole
where securityRole.Name == "System user";
select forupdate userRoleToSave
where userRoleToSave.User == _userId &&
userRoleToSave.SecurityRole == securityRole.recId;
if ( userRoleToSave.recId)
{
userRoleToSave.AssignmentMode = RoleAssignmentMode::Manual;
userRoleToSave.AssignmentStatus = RoleAssignmentStatus::Enabled;
userRoleToSave.update();
}
else
{
userRole.User = _userId;
userRole.SecurityRole = securityRole.recId; // Set the role of the user (System User role is used here as an example)
userRole.AssignmentMode = RoleAssignmentMode::Manual;
userRole.AssignmentStatus = RoleAssignmentStatus::Enabled;
userRole.insert(); // Save user role
info(strFmt('Role assigned to user: %1', userRole.SecurityRole));
}
// Commit the transaction
ttsCommit;
}
How to add the Display method in the form level in D365 F&O
The below examle is to add the form -Data source level adding display method and assigning to form design control.
-
static void createForm(Args _args) { Args args; Form form; FormRun formRun; FormBuildDesign formBuildDesign; FormB...
-
Please click here to access Custom Workflow step by step process:
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...