Posts

Unable to login to AX after DB sync

update the partition for admin user to be run when you get the below error after db sync Failed to create a session, confirm that the user has proper privileges to log on to Microsoft Dynamics DECLARE @NetworkDomain nvarchar(255); DECLARE @NetworkAlias nvarchar(80); DECLARE @SID nvarchar(124); DECLARE @InitialPartition BIGINT; SELECT @InitialPartition=Recid FROM PARTITIONS WHERE PARTITIONKEY=N'Initial' SELECT @NetworkAlias=NETWORKALIAS,@NetworkDomain=NETWORKDOMAIN,@SID=SID FROM USERINFO WHERE PARTITION=@InitialPartition AND ID = N'Admin' UPDATE USERINFO SET NETWORKDOMAIN=@NetworkDomain,NETWORKALIAS=@NetworkAlias,SID=@SID WHERE PARTITION != @InitialPartition AND ID = N'Admin' --check number of partitions SELECT * FROM dbo.PARTITIONS

SQL query for AX 2012 to find number sequence Id's which are near to run out

select top 10 (1.00 * HIGHEST - 1.00 * NEXTREC) / (1.00 * HIGHEST - 1.00 * LOWEST), * from numbersequencetable with (nolock) where (1.00 * HIGHEST - 1.00 * NEXTREC) / (1.00 * HIGHEST - 1.00 * LOWEST) < 0.2 SELECT TOP 10 * FROM dbo.LEDGERJOURNALTABLE WITH (NOLOCK) WHERE JOURNALNUM LIKE 'num seq' ORDER BY RECID DESC

X++ load operating units for financial dimensions CSV import

static void LoadDepartmentCost(Args _args) {     #File     OMOperatingUnit ou,ou2;     OMOperatingUnitType t;     RecId omOpRecId;     NumberSeq num;     IO  iO;     FilenameOpen        filename;// = "c:\\share\\test.csv";//To assign file name     Container           record;     str type;     int counter = 5, alreadyExists = 0;     Dialog          dialog;     DialogField     dialogfileName;     //dialog to load the excel file of contact information         dialog = new Dialog("Upload File");         dialogFilename = dialog.addField(extendedTypeStr(FilenameOpen));         dialog.filenameLookupFilter(["All files",#AllFiles]);         //dialog.filenameLookupTitle("E...

Run AX client with out load balance AOS

Open command promt as admin Navigate to client bin folder cd C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin AX32.exe -loadbalance=0 -aos2=servername:2712 to login to the intended AOS add loadbalance, value, 0 parameter to .axc client configuration

X++ job to get user assigned security roles

static void Job6(Args _args) {     SecurityInfoTable axpUserSecurityTmp;     SecurityUserRole securityUserRole;     SecurityRole securityRole;     SecurityTask securityTask;     UserInfo     userInfo;     SecurityRoleAllTasksView securityRoleAllTasksView;     OMUserRoleOrganization roleOrganization;     OMInternalOrganization internalOrganization;     while select securityUserRole        outer join securityRole                 where securityRole.RecId == securityUserRole.SecurityRole        join userInfo             where userInfo.id == securityUserRole.User             && userInfo.enable == NoYes::Yes        outer join securityRoleAllTasksView           ...

X++ Send Email

SysEmailTable::sendMail(sysEmailId,SysEmailTable::find(sysEmailId).DefaultLanguage , outEMailAddr,     null,     filename,     '',     true,     curuserid(),     true);

X++ Get Admin access

static void AdminOn(Args _args) {     SecurityUtil::sysAdminMode(true);     info("AdminOn"); } static void AdminOff(Args _args) {     SecurityUtil::flushAll();     SecurityUtil::sysAdminMode(false);     info("AdminOff"); }