Tuesday, May 15, 2018

Move AX database between environment

If the active directories are different then the sysadmin role mapping with the active directory will be required to be updated

select SID, Networkdomain, networkalias from userinfo
where networkalias = ''


Find the SID for the user to be mapped in the new Active directory 

Whoami /user

Copy the new SID for the desired user and update the same in the userinfo table 

update userinfo set SID='', Networkdomain = '', networkalias = '' where id = 'admin'


Sunday, May 13, 2018

Windows 10 Task Bar Problems

Had a strange problem today when in the task bar search stopped working. Also the taskbar was opening disabled and i had to open it up multiple time to enable it back.


Follow the below steps to restore the taskbar setting using powershell script

1. Find C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2. Right-click and Run as Administrator
3. Copy this line:
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Monday, January 29, 2018

Power BI D365 Integration

Every external application that needs an access to an Azure resource should be assigned necessary permissions. The registration process for Applications takes care of this.

To view the app registrations follow the following path: -
Goto Services and find App Registrations


Click on App Registrations and set the filter to All Apps
Then search of the name of the application as used when the app was registered on the PowerBI portal (in this case 365-hcpm-demo Power BI Integration )


Once you click on the app you will be able to see the details


At this location one should be able to view and manage most of the properties of the application.

Note: The secret key is only visible once when it is being created and thereafter hidden so if at all you have forgotten your key please delete the existing one and create a new one.

Name, Object id and other properties are visible using the properties tab page.

Reply urls tab page is used to alter the redirection page. 

Tuesday, January 02, 2018

Save RDP credentials

To be able to use saved credentials

1. Open Group Policy Editor via cmd -> gpedit.msc

2. Navigate to Local Computer Policy\Computer Configuration\Administrative Templates\System\Credentials Delegation\
3.Open Setting Allow Delegating Saved Credentials with NTLM-only Server Authentication, set it to Enabled

click on button Show... and in Show Contents window add Value TERMSRV/* Close all windows by pressing OK.

4. Run cmd and enter gpupdate command to update your policy

Sunday, November 19, 2017

Cannot create a record in Workflow tracking status table (WorkflowTrackingStatusTable). Correlation ID: {70B17AE2-AF1A-47A9-937F-39F206AF91DE}, Pending. The record already exists.

Encountered this issue once the system recovered from the RecId max out in the workflow tables. There were certain transactions that were submitted and updated as In-review however the workflow was not triggered for them. The workflow bar was missing and on trying to Re-Submit the workflows the error was received.

Solution :

  1. Shutdown all the AOS instance
  2. Bring up any one AOS, synchronize the database.
  3. Re-Submit the workflow for the failed records.
e.g: 

    TSTimesheetTable    timesheets;
    WorkflowTrackingStatusTable  trackingstatus;

    while select timesheets
    where 1==1
        && timesheets.ApprovalStatus == TSAppStatus::Pending
        //&& timesheets.TimesheetNbr == 'CCM-175040'
    notexists join trackingstatus
    where trackingstatus.ContextTableID == 4627
    && trackingstatus.ContextRecId == timesheets.RecId
    {
        /*
        ttsBegin;
        timesheets.ApprovalStatus = TSAppStatus::Create;
        timesheets.update();
        ttsCommit;
        */
    Workflow::activateFromWorkflowType("TSDocumentTemplate",
                                       timesheets.RecID,
                                       "Resubmitted due to error",
                                       false,
                                       timesheets.createdBy );

    info( timesheets.TimesheetNbr );

AX 2012-Cannot create a record in Workflow tracking status table

Got the message in the workflow. The messages can be seen in the EventViewer and can also be seen on screen if the workflow is triggered using the tutorial form.

The reason for this error is when the RECID of the tables involved and systemSequences is out of sync. Which means the RecId that the system tries to generate for a new record is something which is duplicate and has been generated in the past.

The reason why this mismatch occurs could be anything and is not known to me; however what is important at this point, is to get out of this situation. With the little R&D that i did, i realized the following facts.


  1. The RecIDs are not generated real time from the systemSequences table. In reality each AOS caches a certain amount of RecID and tries to use them. 
  2. Due to the above stated fact the max RecId that is visible directly from SQL database, is different from the one that actually exists in the AOS. Hence it is important that when we are correcting the NextVal in the systemSequences table, the value is fetched using the AOS table and not from the database directly (using SQL scripts).

Solution : 
  1. Check of the Maximum value of the RECID column for the table resulting in the error, in this case it is WorkflowTrackingTable. 
  2. Make sure you check for the value of RECID from AOS and not using the SQL table as there might be records that are not committed to the database. 
  3. Sort the table by RECID in descending order and copy the maximum RecID as reported by AOS. 
  4. Update the systemSequences table by adding 250 to this value to be on the safer side and to avoid cached values. 
  5. Compile the table giving the error on each of the AOS so that the cache's is cleared. 

Monday, October 23, 2017

AX2012 Deploy ListPage with QuickLaunch menu

Generally when a List page is deployed it only gives an option to be deployed in the subsites that have been created in EP.  There could be a scenario where one would want the list page to open with a quick launch menu (navigation pane on the left )

We had created a new list page which had to appear inside the Timesheet Quick Launch Menu. The problem with the deployment was there was no option to deploy inside the Timesheet node, and if the list page was deployed under the EmployeeServices node, the user would lose the Quick Launch Menu each time the url was clicked.

Below are the steps involved to deploy a list page inside a Quick Lauch menu

Step 1. Create a Display menu for the listpage

Step 2. Right click the display menu and deploy the list page to the root site. When the list page is deployed to EP the deployment process will automatically create a WebURL

Step 3. Right click the WebURL menu created and import the page.

Step 4. Select the page (in my case the page name is AFZ_AllocationsListPage) and change the WebModule address. I have added Timesheets in the existing link


Step 5. Now right click on the Page Definition and deploy the page to the new address that has been specified.

Step 6. Once the page has been deployed at the new location the URL can be updated to refer to the new address

Step 7. At this stage the WebURL can be added to the quick launch menu created for timesheets, and when this link is click it would open with the left navigation pane in place as shown below.

Remove Sharepoint Upgrade Bar

To remove the upgade bar the following command can be used in the sharepoint 2013 management shell

Note: Please make sure that the mangement shell is executed using elevated administrator privileges.

Get-SPWebApplication http://afz-svr-int:90 | Get-SPSite -Limit All -CompatibilityLevel 14 | Foreach-Object {$_.AllowSelfServiceUpgrade = $false }

The above command can be executed for each of the hosted sites. 

Sunday, February 05, 2017

Read a given segment value for a given account from the GL

Assuming that one has to read all the values from a MainAccount '20151026' where the Employee dimension 'D6_Employee' = 'E0028'

Below is a sample job for the same 
static void Job10(Args _args)
{
    GeneralJournalAccountEntry          GJAE;
    GeneralJournalEntry                 GJE;
    FiscalCalendarPeriod                FCP;
    SubledgerVoucherGeneralJournalEntry SLVGJE;
   
    DimensionAttributeValueGroupCombination DAVGC;
    DimensionAttributeLevelValue            DALV;
    DimensionAttributeValue                 DAV;
    DimensionAttribute                      DA;
    SPYAmount                               claimAmount;
    HcmPersonnelNumberId                    personnelNumber = HcmWorker::find(5637146086).PersonnelNumber;
   
    while select *
    from GJAE
    join GJE   
    where GJE.RecId == GJAE.GeneralJournalEntry       
        && GJE.AccountingDate >= mkDate(1,1,2017)
        && GJE.AccountingDate <= mkDate(31,1,2017)
        && GJAE.MainAccount == MainAccount::findByMainAccountId('20151026').RecId
    join SLVGJE
        where SLVGJE.GeneralJournalEntry == GJE.RecId
        && SLVGJE.VoucherDataAreaId ==  curext()  
        //reading the individual segments of the entry
    join DAVGC
        where DAVGC.DimensionAttributeValueCombination == GJAE.ledgerDimension
    join DALV
        where DALV.DimensionAttributeValueGroup == DAVGC.DimensionAttributeValueGroup                   
        && DALV.DisplayValue == personnelNumber
    join DAV
        where DAV.RECID == DALV.DimensionAttributeValue
    join DA
        where DA.RecID == DAV.DimensionAttribute       
        && DA.Name == 'D6_Employee'        
    {       
        claimAmount += GJAE.AccountingCurrencyAmount;
    }
}