Posts

Showing posts with the label AX 2012

SQL script to check special characters in Index Name

select i . [name] as index_name ,     substring ( column_names , 1 , len ( column_names )- 1 ) as [columns] ,     case when i . [type] = 1 then 'Clustered index'         when i . [type] = 2 then 'Nonclustered unique index'         when i . [type] = 3 then 'XML index'         when i . [type] = 4 then 'Spatial index'         when i . [type] = 5 then 'Clustered columnstore index'         when i . [type] = 6 then 'Nonclustered columnstore index'         when i . [type] = 7 then 'Nonclustered hash index'         end as index_type ,     case when i . is_unique = 1 then 'Unique'         else 'Not unique' end as ...

AX 2012 DEVOPS Build, Release setup and configuration

Image
After the initial setup in  AX 2012 Build process using AZURE DEVOPS Next step is to setup the build template and run the build process to get model and modelstore file which can be deployed to any environments. Goto your AZURE - DEVOPS dashboard by login to  https://visualstudio.microsoft.com/vso/ If you dont have a account, you can register for one free. Azure DEVOPS dashboard Select project for build process setup Select builds Click new pipeline Select Team foundation version control or the one you setup in intial step to move code to azure repo Select build reporsitory It should be the one you selected in initial setup steps Here select TFVC reporsitory Server path is the branch for which you want the build run Local path under - sourcesdirectory click continue for next step Select a build template - empty pipeline and add the build steps as per the AX build process order Now at the final step of build pipeline creation If y...

X++ Find SSRS print management setting for selected customer and report

static void VNPrintMgmtDoc(Args _args) {     PrintMgmtDocInstance    printMgmtDocInstance;     CustTable                         custTable;     PrintJobSettings               printJobSettings;     PrintMgmtSettings           printMgmtSettings;     SRSPrintDestinationSettings srsPrintDestinationSettings;     custTable = CustTable::find("ABC");     printMgmtDocInstance = PrintMgmtDocInstance::findByPrintType(custTable.RecId,custTable.TableId,PrintMgmtNodeType::CustTable,PrintMgmtDocumentType::SalesOrderInvoice,PrintMgmtDocInstanceType::Original,false);     select printMgmtSettings where printMgmtSettings.ParentId == printMgmtDocInstance.RecId;     srsPrintDestinationSettings = new SRSPrintDestinationSettings(printMgmtSettings.PrintJobSettings);...

AX 2012 Export user security role information to CSV file

static void VN_GetUserSecurityinfo(Args _args) { str                         fileName; boolean                     HasRecord; SecurityUserRole            securityUserRole; SecurityRole                securityRole; SecurityTask                securityTask; UserInfo                    userInfo; SecurityRoleAllTasksView    securityRoleAllTasksView; OMUserRoleOrganization      roleOrganization; OMInternalOrganization      internalOrganization; TextIO                          io; Str                             text; FilePath...

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           ...

SQL: view database restore history

SELECT [rs].[destination_database_name], [rs].[restore_date], [bs].[backup_start_date], [bs].[backup_finish_date], [bs].[database_name] as [source_database_name], [bmf].[physical_device_name] as [backup_file_used_for_restore] FROM msdb..restorehistory rs INNER JOIN msdb..backupset bs ON [rs].[backup_set_id] = [bs].[backup_set_id] INNER JOIN msdb..backupmediafamily bmf ON [bs].[media_set_id] = [bmf].[media_set_id] ORDER BY [rs].[restore_date] DESC

Project list page - to filter and show data as per last selection

public Query applyFilter(Query _query, boolean _saveFilterValues = false) {     //QueryBuildDataSource parentProjTableDataSource, parentProjTableDataSource2;     int s;     //CtrlBottomProjLevels.allowEdit(false);     s = customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels));     if (customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Top)     {         SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueEmptyString());         //ProjTable_ds.executeQuery();         //ProjTable_ds.query().dataSourceTable(tableNum(ProjTable)).clearRange(fieldNum(ProjTable, ParentId));     }     else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == Proj...

Collection list page in sales ledger

If collections list page form in sales ledger/commom/collections does not show data. Make sure and run customer ageing snapshot in sales ledger/periodic

CLR Error - AX 2012

When you have visual studio projects added to AX. Errors may occur at different times when generating CIL. Error - Object synchronization method was called from an unsynchronized block of code. restart AOS  Run full CIL Error  - assembly containing type is not referenced Check the assembly .dll file is in the server/vsassemblies folder. Check if you can access the assembly in a x++ job and you are able to call the methods. Add the AOS account to the assembly in above folder.

XPO import error

When importing a XPO, if following error occurs "table, enum, edt, object already exists. import aborted". Solution 1 Restart AOS Sync data dictionary Try importing again Solution 2 Goto tools/Caches--refresh all. Try importing again. It should work

X++ Confirm, Invoice and cancel purchase order

static void POConfirm(Args _args) {     PurchTable      pTable;     PurchFormLetter purchFormLetter;     AxPurchTable    axPurchTable;         select pTable where pTable.PurchId == "POnumber";         //Posting PO Confirmation     //You cannot do invoice without doing PO confirm     //purchTable = axPurchTable.purchTable();     purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);     purchFormLetter.update(pTable, strFmt("%1", pTable.PurchId));     //Posting PO Invoice    // purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);     //purchFormLetter.update(pTable, strFmt("%1", pTable.PurchId));  } Cancel a PO static void cancelPO(Args _args) {     PurchTable      pTable;     PurchCancel     pCancel; ...

GAB HR Worker access security

Global address book has all the workers, contacts, suppliers, customers info and also if a contact is been created and if HR wants to hire that contact(person). We can change that contact as worker from GAB itself. GAB has most of worker data as public, any one with GAB access can change the worker info like name and it is updated in HR module. if a worker address book is created and assigned to all the workers. A team is created, who has only access to that address book(like HR team). If we enable the security policy in org admin GAB parameters A user not in the HR team cannot see the workers in other modules like Procurement and project. As this will lock down workers not only in GAB nut also in other modules. Solution is to lock the edit property for the contacts in the GAB if he is a worker.

X++ Job to update worker contact information by excel upload

Upload a excel file to update the already existing Worker contact information HR/Common/Workers/List Edit/Profile->Contact Information. Note: In the Excel file all the columns should be formatted as Text and the fields should be given according to below header format. PersonnelNumber, contactdescription, contacttype,contact,contactext,primarycontact,privatecontact 123,abc, email address, abcxyz@blogger.com, ,yes,no static void EmployeeContactInfo(Args _args) {     SysExcelApplication application;     SysExcelWorkbooks workbooks;     SysExcelWorkbook workbook;     SysExcelWorksheets worksheets;     SysExcelWorksheet worksheet;     SysExcelCells cells;     COMVariantType type;     System.DateTime ShlefDate;     FilenameOpen filename,filenameopen;     dialogField dialogFilename;     Dialog dialog;     LogisticsLocation logisticsLocation  ...

AX 2012 X++ form splitter

class declaration of form public class FormRun extends ObjectRun {    SysFormSplitter_Y formSplitter_Y;//splitter moves in y- axis and it is vertical splitter container    SysFormSplitter_X formSplitter_X; //splitter moves in x- axis and it is horizontal splitter container } InIt method of form public void init() {     super();     formSplitter_Y = new SysFormSplitter_Y(Splittergroupname,top or bottom group name,this/element); formSplitter_X = new SysFormSplitter_X(Splitter,top,element);//splitter moves in x-axis when u take two tabs side by side } In design column property given as 2 to split the form to two section Override below methods in the splitter group control for moving splitter mouse up(override method) public int mouseUp(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift) {     int ret;     ret = super(_x, _y, _button, _Ctrl, _Shift); ...