Microsoft Dynamics Ax 2012 Custom financial dimensions Lookup

There was a requirement to create a new field on a table that should be populated from a custom financial dimension values and need to show a lookup on the data entry form for this field that will populates the data from your custom financial dimension.

First need to identify the relevant tables that are needed to fulfill this requirement:

  • DimensionFinancialTag
  • DimensionAttribute
  • DimensionAttributeDirCategory
  • FinancialTagCategory

The list of values for custom dimension are stored in the table DimensionFinancialTag. But this table stores custom values for all custom financial dimensions. To determine which of the records to filter out and show we will have to apply a filter on the field FinancialTagCategory. How do we figure out the FinancialTagCategory value? We do that by traversing from the DimensionAttribute table (hold a records for your financial dimension).

The table DimensionAttributeDirCategory holds a link between DimensionAttribute and FinancialTagCategory, this table is used to retrieve the financialtagcategory and filter the records in the table DimensionFinancialTag.

Following is the Sample Code:

static void MyCustomFinancialDimensionLookup(Args _args)
{
SysTableLookup                      sysTableLookup;
Query                               query;
QueryBuildDataSource                qbdsDimensionFinancialTag;
QueryBuildRange                     qbrFinancialTagCategory;

#define.MyCustomFinancialDimension(‘MyCustomFinancialDimension’)

query = new Query();
qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
qbrFinancialTagCategory.value(strFmt(‘%1’, DimensionAttribute::findByName(MyCustomFinancialDimension, false).financialTagCategory()));

sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), this);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();
}

Microsoft Dynamics Ax 2012 Inbound port using File system Adapter Error: Duplicate message. Message has already been processed

Yesterday we get the following error during import of XML File containing message ids.

“Event Description: Object Server 01: An error has occurred in the services framework. Method: AifMessageInspector::AfterReceiveRequest. Error: System.ServiceModel.FaultException`1[Microsoft.Dynamics.Ax.Services.AifFault]: Duplicate message. Message has already been processed. (Fault Detail is equal to Microsoft.Dynamics.Ax.Services.AifFault).”

Reason:

XML File contain the message ID’s that were already imported to system.

Solution:

By updating the Message ID’s that were already imported to the system and run the import process it work fine.

Following is the example work around that has been done to fix the issue:

Change the message id value at the end of id. From Message ID.

{5603D03A-4380-404D-9F27-738BE0FEA14F}

To message ID:

{5603D03A-4380-404D-9F27-738BE0FEA18F}

The Basic Rules of a Successful Supply Chain

Supply Chain

The Supply Chain is the process through which a company creates and distributes its products and services to the end user. It includes a number of specific elements; production planning, material sourcing, transportation management, warehouse management and demand management. These functions are tightly integrated to provide the products and services to the end user in an efficient, timely and profitable manner. It is important to continually monitor your supply chain with following principles.

  • Demand triggers must be identified as quickly as possible
    • There is no doubt that getting the right part to the right place at the right time – as quickly as possible – is the #1 priority of a supply chain.
    • This requires that at any given time you have enough of the right parts in your supply chain. In order to assure this occurs, many supply chains err on the side of caution, having too many of every part. In many cases, far too many. To understand why, we must look at how stock arrives in a supply chain in the first place. Stock exists in a supply chain for any or all of these three reasons:
      • It is the most economical way to move materials from point A to point B (and points C and D and E)
      • The variable nature of supply, in terms of late delivery, quality failure rates, etc.
      • The variable nature of demand, both in timing and quantities.
  • Make sure the person who is supposed to take action acknowledges and confirms this requirement.
    • Everyone in the direct line from supply to usage should know that the triggered event has a) taken place and b) been acknowledged by the person responsible for making sure that any next steps are set in motion.
  • Everything needs to remain in context.
    • Each time a trigger occurs – or data is collected – your supply chain should include a mechanism for answering the following question: is this a ‘normal’ event, an ‘extraordinary’ one, or something in between?
  • Mechanisms for clarification are critical.
    • There needs to exist a way for the supplier to ask the direct line customer and  their customer(s) to explain, as in case of unusually early trigger. This can be as simple as an e-mail from the supplier or as robust as a shared portal.
    • Without the opportunity for clarification, most suppliers will err on the side of ‘just in case’, meaning they will select the possibility that results in extra stock
    • just in case, which puts us back where we started
  • Task individuals, not committees.
    • A supplier has queried its customer about an abnormally early order for a small batch of parts. How? The supplier sent an e-mail. So far so good? Not quite. The e-mail was sent to all five people in charge of that portion of the supply chain. Each assumed someone else would respond and, well, with so many other things going on, the clarification request was lost in the shuffle. The supplier assumed that no additional effort was required. Unfortunately, the abnormally early order was the first trigger for an increase in production. More ‘abnormal’ triggers start coming in and shortages appear throughout the chain.                                                                 The solution here is to make sure that one person, not a committee, is tasked with replying to a discrete list of suppliers and/or portions of the chain. Others can and should be included for technical assistance, input, backup, etc. but no more than one person should be accountable for assuring that replies are sent within a predetermined period of time, dependent on the priority level of the request and/or component.
  • Group similar tasks, not just similar priorities.
    • Once parts are manufactured, we need to find the best combination to:
      • The fastest way to move the parts.
      • The lowest cost to move the parts.
      • The lowest cost to store the parts.
  • Evaluate risk in threes: the forecast, the demand data, and
    the understanding that forecasts are skewed by previous bad
    events.

    • A stock-out can be a very expensive event, so it’s always important to err on the side of having a few too many of a needed item instead of cutting the need too close. But how many is too many? And how close is too close? We all know this but what is less obvious is how we can best assess the likelihood of the stock-out or shortage and find a level of confidence that balances the risk. For this we will need to see both sides of the equation:
      • The forecast data – showing how many of each item we anticipate needing, and any mitigating future factors, such as ramped up or decreased orders.
      • The historical (pull) data – showing how fast we are using the supplied parts and how closely the actual usage matches the forecasted usage.
  • Motivation should be a foundation, not an afterthought
    • Before we implement any change – whether it’s an upgrade, a new technology, or even the elimination of a step in the process – we must keep in mind that people, not technology or spreadsheets, make up the backbone of every supply chain.
    • People, unlike machines and materials, require motivation to function at their best.
  • Don’t reward bad suppliers with increased orders.
    • No discussion on motivation within the supply chain can be complete without one of the classic examples of negative motivation: buying more stock from suppliers with poor delivery histories.
    • The reason for this is clear. To buffer yourself against their unreliable supply you add more stock, thus rewarding the supplier’s poor performance with larger orders. Conversely, the good suppliers are punished for their reliable performance with smaller orders, shorter lead times, and, most likely, smaller profits.
  • The more things change, the more things need to be able
    to change.

    • A successful supply chain should not be static but always adapting to the changes in the business. A supply chain should be a source of opportunity, not a constraint.

Microsoft Dynamics AX 2012 R3 New Features – Warehouse management

In previous article we have covered the several features that are added or changed in Microsoft Dynamics AX 2012 R3 Transportation management.

In this article we will cover the Warehouse management:

In Microsoft Dynamics AX Warehouse management can be used to monitor and automate warehouse processes. The Warehouse management module for Microsoft Dynamics AX 2012 R3 lets you manage warehouse processes in manufacturing, distribution, and retail companies. For example, you can use the features in this module to complete tasks in the following areas.

Following are the features are added to Dynamics AX 2012 R3:

  • Workflows – Configure inbound and outbound intelligent workflows.
  • Picking and packing – Assign orders to clusters to pick from a single location and configure profiles to control the validation and packing of items into shipping containers. Alternate between picking strategies for batch and non-batch items.
  • Wave processing – Create, implement, and release work using batch-scheduled or manual processing of waves.
  • Inventory counting – Set up cycle counting thresholds, create cycle counting plans, schedule plans, and cycle count locations and items ad hoc.
  • Containerization – Set up container groups to order the sequence of the packing process and create templates to support packing strategies.
  • Mobile devices – Use scanners or other mobile devices to optimize precision in the picking and put-away processes.

Dynamics AX the Setup wizard does not start, EXE file is opening a Microsoft Visual Studio

Issue Detail:

When you click Microsoft Dynamics AX EXE file in the initial installation. It’s opening a Microsoft Visual Studio instead of Installation Wizard.

Reason:

By default, HTML Application Host is the program that is associated with the .hta file type. However, if Microsoft Visual Studio is installed on Windows Server 2012, the .hta file type can be associated with Visual Studio instead

Solution:

To resolve this issue, you can use one of the following options:

  • Before you run Setup, use the Default Programs Control Panel to associate the .hta file type with the HTML Application Host program.
  • If you are prompted to choose a program with which to open setup.exe, choose HTML Application Host.
  • Right-click the file setup.exe and choose Run as administrator.
  • Right-click the file setup.exe and choose Properties. Click the Compatibility tab. Under Compatibility mode, select Windows 7.

Microsoft Dynamics AX 2012 locking concurrency

When we are writing a code that is updating or inserting records in the database, we need to be aware of Microsoft Dynamics AX 2012 locking concurrency and how the structure of our code could impact locking.

We are going to cover this scenario with following example X++ Code and SQL Script:

X++ Code Example (job can be used to see the locking behavior)


static void LockExample(Args _args)
{
CustTable custTable;
ttsbegin;
While select forupdate custTable where custTable.AccountNum == ‘001320’
{
custTable.BankCentralBankPurposeText = ‘UpdatedText’;
custTable.update();
print custTable.BankCentralBankPurposeText;
}
ttscommit;
}


Put a breakpoint on the While statement, on the Update, Print and on ttscommit.

Open SQL Server Management Studio, and run the following script at each breakpoint. Again, this script could be easily modified to include additional information from the SQL DMV’s


select t1.request_session_id,t1.request_type, t1.request_status,t1.resource_type, db_name(es.database_id),es.login_time,es.program_name,es.login_name,es.nt_user_name, es.open_transaction_count from master.sys.dm_tran_locks t1
with (nolock) join master.sys.dm_exec_sessions es with (nolock) on t1.request_session_id = es.session_id where
es.program_name = ‘Microsoft Dynamics AX’
and es.login_name = ‘CORP\admin’
and es.open_transaction_count > 0


The locks are acquired on the Update statement but they are not released until the ttscommit. Because we specified forUpdate in our Select statement above, concurrency will default to that specified on the table. The table custTable has OCC Enabled set to Yes, so the Select uses Optimistic Concurreny. We can force the use of Pessimistic Concurrency by replacing the forUpdate like:


While select pessimisticLock  custTable where custTable.AccountNum == ‘001320’
{
custTable.BankCentralBankPurposeText = ‘UpdatedText’;
custTable.update();
print custTable.BankCentralBankPurposeText;
}


Try changing the job to run this way and this time put a breakpoint right after the Select. Notice the difference in the locking behavior. Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update

After Database restore, server is unavailable Error in Dynamics AX

Database restore Issue:

After Restoring Database Backup and tried to start Dynamics AX got following error

Error:

“The server is unavailable. Check your configuration and network connection and try again”

Reason:

When we restore the database where references are still from Old DB backup and service cannot be started with current network credentials.

Solution:

update configuration:

  1. To get SID using Open command window and write Whoami /user press enter SID Will be shown
  2. Start SQL Server Management Studio and execute following command by providing values:
update userinfo set SID='<SID>', Networkdomain = '<Network_domain_name>', networkalias = '<Network_alias>' where id = 'admin'

3. Restart AOS