Tuesday, October 7, 2025

UnionBranchNumber and the magic of unions in X++

IF you check out the view HCMCommplensationPlan, you will notice there is a method called plan type which is a view method

public class HcmCompensationPlan extends common
{
    public static str planType(int _unionBranchNumber)
    {
        HrmCompPlanType planType;
        switch (_unionBranchNumber)
        {
            case 1:
                planType = HrmCompPlanType::Fixed;
                break;
            case 2:
                planType = HrmCompPlanType::Variable;
                break;
        }
        return SysComputedColumn::returnLiteral(planType);
    }
}

The unionBranchNumber parameter here is basically the number of the datasource in the union join. 


The parameter automatically pics the first datasource as case 1 and the second datasource as case 2. This threw me off as I have not seen any documentation on this, but if you find some, do share.


Tuesday, August 26, 2025

The not equal to operator that you have never seen!

 So, I recently found out about this not equal to operator


i.e. this


And I think this is hilarious! I am not even sure where on the keyboard this option is, and how you are supposed to access this.

Thursday, August 14, 2025

Weird behaviour of setPrefix method in D365 FO. Do not use with if condition

 For some reason you cannot do 

{
    setPrefix("MESSAGE");
}
while()
{
    info("ChildMsg");
}


This means you cannot have setPrefix in an if condition or anything which needs curly brackets, the kernel calcualtes what to group based on the curly brackets and as soon as you add any extra, nothing breaks, but it stops doing what it is supposed to do. Could not find any documentation on it so added it here

Friday, May 9, 2025

Backup and restore print management settings

To quickly move print management settings between environments like UAT and FAT 

Pre-requisites

Environment:

  • At this time latest config is stored in UAT

Backup scope identified
Print management settings:

  • PRINTMGMTDOCINSTANCE
  • PRINTMGMTIDENTIFICATIONTEXT
  • PRINTMGMTREPORTFORMAT
  • PRINTMGMTSETTINGS

Work templates:

  • WHSWORKTEMPLATETABLE
  • WHSWORKTEMPLATELINE

Customer pool:

  • CUSTCOLLECTIONSPOOL

Export settings to a backup database
Login to T1 Dev VM 
Connect to local SQL Server
Create new database (or use database created in the previous backup)



On the new database click Import Data



Select data source



Select destination (local DB created above)


Select tables to be copied (e.g. PrintMgmt*)


If target tables to be truncated - use Edit mapping and select "Delete rows in destination table"



Repeat this for each table that needs to be truncated.

Run the package



Import settings from a backup
For this - export settings from the backup database (created when taking a backup using guide above) to the target environment AxDB database.

Use Export Data option



Select data source


Select destination


Select tables to be included


Select all and click Edit mappings and select delete rows in destination tables:


Run the package

Example summary:


Additional info
Some tables have read-only fields, for example SysRowVersion.
Set destination to <ignore> via Edit mappings option:


Tables affected:

  • WHSWORKTEMPLATETABLE
  • WHSWORKTEMPLATELINE
  • CUSTCOLLECTIONSPOOL

Monday, March 17, 2025

Things to think about for integrations

 Considerations and questions

  • Scope
    • The application interfaces for consideration 
    • To confirm the data being integrated

  • Transport and Broking
    • Is there an Enterprise Service Bus currently in use? Is this a standard that we should adopt
    • Where does the demarcation between connected systems lie?
    • Is Canonical Form being used?
    • Is there a standard transport mechanism for messages between systems? Can we use the Azure Service Bus?
    • Is there a standard used for systems to subscribe to messages of specific types?
    • Are messages lightweight, and how should their payloads be informed?

  •  Resilience
    • What status information should integrations return?
    • Are there standards we should adopt for service availability and recovery?
    • How should the connected systems recover from failure, regarding integrations?
    • Are outages captured anywhere?

  • Security
    • To describe current good practices that we should adhere to.
    • Confirm that we may use Azure Key Vault and Managed Identities as required.
    • To confirm levels of encryption for data in transit.
    • To confirm levels of encryption for data at rest.

  • Operation
    • For each set of data being moved, should this be synchronous/asynchronous?
    • If synchronous, what would be the trigger?
    • If asynchronous, what would be the frequency?
    • Where should error messages be surfaced?
    • Who will monitor and maintain the integrations?
    • What telemetry should be captured and how?
    • Will test systems for line-of-business applications be available?