Tuesday, April 26, 2016

RECID Maxed out

We have been struggling with this issue of the system sequences table is getting maxed out on the RECID for some tables. While the table that gets maxed out are random and without a pattern it mostly happens for table no 65482.

We also identified that this happens mostly when some user logs into the system. Which led to a conclusion that there is something at the user login stage that is causing the problem. We took some help from microsoft support desk and generated the trace file for the login steps.

 To generate the startup trace file follow the following steps : -
  1. Login to the application server where the AOS is installed. 
  2. Start the performance monitor  (start -> run -> perfmon ) and initiate the trace log
  3. Go to User Defined and new 
  4. Create the new trace using the AOSTRACE.XML template 
  5. Log in with a client and stop it
  1.  Each trace would be created and saved in a folder with an .etl extension
  2. Copy the trace file created and open the same in Microsoft Dynamics AX Trace Parser. (can be found on the product CD).
When the trace file was analyzed it was found that the system was trying to run the initialization checklist on startup. This was evident from the fact that there were records in the following tables with running status.

  1. Syssetuplog 
  2. Syssetuppartitionlog  

These records were deleted using the following scripts : -



Delete from Syssetuplog
Where description like ‘Running’


Delete from Syssetuppartitionlog
Where description like ‘Running’

Once the above records were deleted we emptied all the compilation log and libraries and did a fresh compile of the application. 
The following table was truncated in the model database to get rid of any previous logs
  • SYSXPPASSEMBLY
       The following folders were truncated in the AX server folders to delete the CIL libraries
  •  C:\Program Files\Microsoft Dynamics AX\60\Server\XXX\bin\XppIL


It is assumed that that the initialized checklist got initiated when the second AOS was installed on our server. The process followed to compile and load an environment with 2 AOS servers was as follows


  1. Stop All AOS
  2. Start one AOS and wait until it is Running
  3. Run AXBUILD on that AOS C:\Program Files\Microsoft Dynamics AX\60\Server\XXX\bin\AXBUILD.exe xppcompileall
  4. When Finished with compilation, Restart this AOS
  5. Log into a client and run a FULL CIL
  6. When finished, stop the client, Stop the AOS
  7. Start the second AOS and wait until it is up running
  8. Start the First AOS
  9. Log in users
We also noticed an event viewer log suggesting a missing stored procedure in AX.
Run AXUTIL SCHEMA 
Run AXUTIL OPTIMIZE to rebuild the model database


Another possible reason that was potentially considered for the max out was that maybe due to internal procedures using the SystemSequences Table it is possible the locks are being escalated and the table is getting locked out. When AX is trying to read the locked table it is possible generating a higher no to avoid a duplicate.

ALTER TABLE SYSTEMSEQUENCES

SET (LOCK_ESCALATION = DISABLE);

Sunday, March 27, 2016

SSRS Report Caption

Had this strange issue when the dialog of the report was not updated for the caption. The dialog picks the value for the first time from the MenuItem, however this only happens at the time of first run and there after the details are saved in usage data.

The only means to get rid of this information is to clear the usage data. Use the below filters
RecordType = Class
ElementName = SrsReportRunController


Select the data relevant to the report to be refreshed and press CTRL + F9 to delete the records.

Sunday, January 17, 2016

Permissions to Dimension Control

We had this issue in an implementation, where the payroll manager was not able to view the dimensions tab on the employment form. This tab was required to be filled in by the payroll manager to cost the right dimensions for the payroll. As the control is painted using a class and there is no MenuItem to grant permissions to, this particular case has to be resolved using explicit permissions.

Below is how the permissions were granted.

  1. Open the security Role using AOT, the one which requires the permissions to this tab. 
  2. In the Role node expand the permissions node and then browse to forms node
  3. Right click and add the form in question. You can also drag the form in this node if it is open in a separate window. 
  4. Once the form appears right click on the form and add new control. You can also drag the control called TabFinancialDimension onto the form, if the form is already open in a separate window.
  5. Once the tab has been added, select the tab and look up the property sheet and update the effective access property to a relevant value. 
The above case where explicit permissions are required to be granted to a specific control on a form occurs when the control property for need permission has been set to Manual. In all other cases once a permission to the form has been granted the same permissions are cascaded to all the controls on the form.

Monday, November 16, 2015

AX 2012 EP Error to display approvals page

One fine day we encountered a strange error on the Enterprise Portal. This error was flashed when the Approvals page was being displayed.

Field Group Details does not exist.




This error was quite specific that the system expects a field group called Details in some table but we were not sure where. Finally after a lot of hit and trial we found that the issue is with the way the EP approval page display is structured. The system expects that for any table participating in the workflow there should be a details field group designed.

We started getting the above error once a new workflow was enabled for the user and the workflow involved a table (where the workflow status is maintained) which was missing a group called details. We added this group to the table and the page was up again.

Thursday, October 15, 2015

RAM DISK

Recently i moved from a HDD to a SDD the results are fantastic. I now boot my windows in less than 20 seconds. This led me to investigate further on SDD drives and understand what else can i do to have a good performance with my laptop (and obsessed i am with performance).

The first thing i understood is that to have a good life for the SSD we should try and limit the no of reads and write. Once of the potentials areas where this can be limited in the temp work folder for windows and internet explorer.

The solution is to create a RAM disk and move the temp contents to this disk. Obviously this would also mean that we will have to find a solution to persist the contents of the RAM Disk which otherwise looses its contents on a restart.

I landed on an application call imdisk which is a freeware and does the job pretty well. Along with imdisk we need a utility called rawcopy to store the contents of this disk on a shutdown. The right solution would be to automate the two events, for this we would need two batch files in windows called shutdown and startup respectively. The details of these files are as follows:-

contents of the shutdown batch file
C:\RAMDISK\rawcopy.exe -mld \\.\R: "C:\RAMDISK\RDrive.img"

contents of the startup batch file
imdisk -a -t vm -f C:\ramdisk\rdrive.img -m R:

These files can be scheduled either using the windows task scheduler. Alternatively an entry can be made in the group policy (gpedit.msc) under
Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts

Double click on Startup or Shutdown applets on the right pane and add the batch files therein.



Thursday, October 01, 2015

XDS MyConstruct

My construct is a pattern used to implement record level security when the business logic to implement the restriction is not straight forward.

Eg. We had a requirement at a customer where the HR wanted the records to be restricted as per the position hierarchy. So if a manager logs in he should be able to see managers reporting to him and any subordinates below these managers.

The answer to the above problem is to implement the My construct pattern for security. My Construct uses temporary tables of type TempDB which are populated using a table method called XDS().  This method is available for developers to write X++ logic to populate the temporary table. After the temporary table is populated, subsequent policy queries can use this temporary table.

In MyConstructs, we have the ability to refresh the data either PerSession or PerInvocation.

Below is the code for an overridden XDS method of a table

public RefreshFrequency xds()
{
    SPYMYSubordinate                mySubordinate;
    List                            workerList = new List(Types::Int64);
    ListEnumerator                  workerListEnumerator;
    HcmEmployment                   hcmEmployment;

    List subordinate(HcmWorkerRecId _worker,List _workerList)
    {
        HcmPositionHierarchy            positionHierarchy;
        HcmPositionWorkerAssignment     positionWorkerAssignment;

        _workerList.addEnd(_worker);
        while select positionWorkerAssignment join positionHierarchy
            where positionWorkerAssignment.Position == positionHierarchy.Position &&
                  positionHierarchy.ParentPosition == HcmWorker::getPrimaryPosition(_worker) &&
                  positionHierarchy.PositionHierarchyType == HcmPositionHierarchyType::lineHierarchyType()
            join hcmEmployment
            where hcmEmployment.Worker == positionWorkerAssignment.Worker
        {
            _workerlist = subordinate(positionWorkerAssignment.Worker,_workerlist);
        }
        return _workerlist;
    }

    workerList = subordinate(currentWorker(),workerList);
    workerListEnumerator = workerList.getEnumerator();
    while(workerListEnumerator.moveNext())
    {
        mySubordinate.Worker = workerListEnumerator.current();
        mySubordinate.insert();
    }

    return RefreshFrequency::PerSession;
}

Wednesday, September 30, 2015

Refresh SSRS Report

There is this common problem encountered while working with SSRS reports and AX 2012. The report changes are not reflected on the SSRS Reports servers

I found a sequence of steps which if followed ensures that the Report is updated. These steps are as follows:
  1. Rebuild all on Visual Studio Project
  2. Add the project to AOT
  3. Right click the report on AOT and Restore
  4. Deploy element from AOT 
Hope for the best :-)