Dynamics AX Blog - Dynamics AX 2012 - Posts from 2018

These posts are machine-translated.
Currently, only posts are displayed, which are relevant for Dynamics AX version »Dynamics AX 2012« Filter entfernen

RSS-Feed of this version
Currently, only posts from »2018« are displayed

Reading the contents of an AXMODEL file

Microsoft Dynamics AX 2012 Management ShellIf you get a hotfix from Microsoft or a module from a Microsoft partner, you often only get one or more AXMODEL files. And there is often a great desire to know in advance which objects are affected by the import of this file.

Such information can be read with the Microsoft Dynamics AX 2012 Management Shell:

Get-AXModel -File 'c:	empdynamicsax2012r3_cl4555332.axmodel' -Details

Here's how it looks:

Manifest                   Summary                    Elements
--------                   -------                    --------
Microsoft.Dynamics.AX.F... {Classes: 3}              {ClassesWHSLoadLineI...

 
 
 

Create cost center by code

If you are ever embarrassed to have to create a cost center by code, this job may serve as inspiration:

static void createCostCenter(Args _args)
{
    str 30 _costCenter = "0815"; // Cost center id to create

    OMOperatingUnit omOperatingUnit;
    NumberSeqFormHandler numberSeqFormHandler;
    NumberSeq numberSeq;

    if (_costCenter)
    {
        if (!OMOperatingUnit::findName(
            _costCenter, OMOperatingUnitType::OMCostCenter))
        {
            ttsbegin;
            numberSeq = NumberSeq::newGetNumFromId(
                OMOperatingUnit::getNumberSequenceReference().NumberSequenceId);

            omOperatingUnit.clear();

            omOperatingUnit.initValue();
            omOperatingUnit.omOperatingUnitNumber = numberSeq.num();
            omOperatingUnit.Name = _costCenter;    // Id used as name
            omOperatingUnit.NameAlias = _costCenter;
            omOperatingUnit.omOperatingUnitType = OMOperatingUnitType::OMCostCenter;
            omOperatingUnit.LanguageId = CompanyInfo::languageId();

            if (omOperatingUnit.validateWrite())
            {
                omOperatingUnit.insert();
            }
            ttscommit;
        }
    }
}

 
 
 

SysOperation framework: Pass selected records from a temporary table

In the following scenario, all records of a temporary table are to be passed to a SysOperation construct.

For that we need:

  • In the DataContract, a accessor method (parm-method) that takes a container
  • In the controller, a logic that iterates the records of a calling data source and packs it into a container, and passes it to the service using the above method
  • In the service class we need code, which unpacks and processed the transferred container

 

Controller

class TutorialSysOperationController extends SysOperationServiceController
{
}

 
 
 

Enter price information on order lines through code and control price search

A common requirement in projects is that sales order lines should be created by code, such as data imports or similar.

Recently I had the request that code-generated sales order lines are then to be processed manually, but the price information such as sales price and rebate should be preserved.

However, editing certain fields in a sales order line in Dynamics AX triggers price search. This had to be prevented or pointed out to the user at least by a query. Fortunately, there is already one such query, which is controlled by the following fields:

Field Description
ManualEntryChangepolicy Reference to table PriceDiscChangePolicy
SystemEntryChangePolicy Reference to table PriceDiscChangePolicy
SystemEntrySource BaseEnum

 
 
 

Split a string with fixed separators

The following snippets are meant to show how to extract the individual elements from a string with fixed separators.

Variant 1: Convert the string to a container using str2con()

static void Job1(Args _args)
{
    str paramAsStr = "Wert1@@Wert2@@Wert3";
    container paramAsCon;
    int i;

    paramAsCon = str2con(paramAsStr, "@@");
    
    for (i=1;i<=conLen(paramAsCon);i++)
    {
        info(conPeek(paramAsCon, i));    
    }
}


Variant 2: Convert the string to a list using strSplit()

static void Job1(Args _args)
{
    str paramAsStr = "Value 1|Value 2|Value 3";
    List paramAsList;
    ListEnumerator le;

    paramAsList = strSplit(paramAsStr, "|");
    
    le = paramAsList.getEnumerator();
    while(le.moveNext())
    {
        info(le.current());    
    }
}

 


 
 
 

Create waves for one or multiple deliveries

The following snippet shows how to build waves and work for one ore more delivery through code. This will usually happen if you use the "Release to warehouse" function.

WHSWaveTable::buildWaveFromShipments(['USMF-000006','USMF-000007']);

 
 
 

Updating an AX 2012 R3 VPC

Recently, I wanted to update my locally installed AX 2012 R3 CU8 to a newer version. This requires the following:

  • Access to Lifecycle Services (LCS)
  • At least a couple of hours

Below are some screenshots and comments I made during the update.

Log in to LCS and download the installer

Screenshot


 
 
Pages 1 2 » 

 

 
 
 
Posts of the actual month
April 2018
MoTuWeThFrSaSu
 1
2345678
9101112131415
16171819202122
23242526272829
30 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.