How to Import Records from Excel Using X++ Code in D365FO

  How to Import Records from Excel Using X++ Code in D365FO   Include the below namespace in X++ code it will requires to import Excel. Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange;   In addition to the basic reference, include (Directory and DirectoryUpgrade Packages) X++ Code: Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange; class ReadExcel {   public static void main(Args _args)    {     Int id;     Str Name;      System.IO.Stream stream;       ExcelSpreadsheetName sheet;              FileUploadBuild fileUpload,fileUploadBuild;       DialogGroup dialogUploadGroup;       FormBuildControl formBuildControl;   ...

Create a new user in D365 FO using X++

X++ Code to Create a new user in D365 FO :

UserInfo                              userInfo;
AxaptaUserManager
      Axmanage;
xAxaptaUserDetails
         Axdetails;       


Axmanage                                       = new AxaptaUserManager();
userInfo.accountType                  = UserAccountType::ClaimsUser;
userInfo.networkAlias                 = "Name@abc.com";
userInfo.networkDomain           = "https://sts.windows.net/";
userInfo.id                                      = "ID";
userInfo.name                               = "NAME";
userInfo.company                        = "LegalEntityName";
userInfo.enable                            = NoYes::Yes;
UserInfo.IdentityProvider         = Microsoft.Dynamics.AX.Security.AuthenticationCommon.AadHelper::GetCanonicalIdentityProvider(userinfo.networkDomain);      
// To get SID of user, without this user will not be able to login to ax, just user will be shown into user form
Axdetails                                          = Axmanage.getSIDFromName(userInfo.networkAlias, userInfo.IdentityProvider, UserAccountType::ADUser);
     
userInfo.sid                                    = Axdetails.getUserSid(0);
userInfo.insert();

Comments

Popular posts from this blog

D365 FO: REFRESH CALLER FORM DATA SOURCE FROM A CLASS X++

Passing Args from one Form to another Form in dynamics AX

CREATE AND POSTING PURCHASE ORDER THROUGH X++ DYNAMICS AX