Showing posts with label Dynamics AX. Show all posts
Showing posts with label Dynamics AX. Show all posts

28 November 2013

AX 2012 Setup requires Windows Update service

I just tried to install EP on an AX Server at a customer. But i always got the following error message telling me that AX Installation was not able to start a service. But there is no hint about the service that is required to be started. After a sharp look at the services that has been deactivated I found out that the "Windows update" service was deactivated. Due to the fact that the installer is searching for updates during installation progress it requires this service. If this service is not set to manuel or automatic the setup is not able to continue.

The German message was:
System.Runtime.InteropServices.COMException (0x80070422): Der angegebene Dienst kann nicht gestartet werden. Er ist deaktiviert oder nicht mit aktivierten Geräten verbunden. (Ausnahme von HRESULT: 0x80070422)

So if you have an error message that contains the number 0x80070422 or 80070422 better check if the windows update service is running.

21 August 2012

Difference between two dates in days

To get the difference between two dates in dynamics ax just convert the dates into numbers and subtract one from the other. The result would be the amount of days between these dates.

days = date2num(Date123) - date2num(Date234);

To get the difference between two DateTime Values just use the DateTimeUtil Class. The result is the difference in seconds. So just divide these through #secondsPerDay and you'll get the days

#timeConstants

days = DateTimeutil::getDifference(DateTime123, DateTime234) / #secondsPerDay;

20 April 2011

Convert DateTime String to UTCDateTime

If you need to convert a string containing a DateTime use the following function:
dateTime = str2datetime("24.12.2011 12:01:59", 123);

dateTime = str2datetime( "2011/02/25 23:04:59" ,321 );
dateTime = str2datetime( "Feb-2011-25 11:04:59 pm" ,231 );
dateTime = str2datetime( "2 25 2011 11:04:59 pm" ,123 );
The sequence 123 describes the position of day (1), month (2), year (3). The function DateTimeUtil::any2DateTime() is working different. it is working with dates but its not working with strings:
Date date = 01\05\2012;
;

DateTimeUtil::newDateTime(date,str2time('00:00:00'));

27 January 2011

Dynamics AX Shortcut Parameters (startup)

If you need an AX Shortcut thats starts a special configuration uses a startup cmd or starts in a different language these parameters will help :)
  • regconfig
  • startupcmd
  • language
A shortcut might than look like this: C:\......\ax32.exe -regconfig=NAMEOFCONFIG -language=de -startupcmd=TWI

To compile the Apllikation on startup use the following command:
 -startUpCmd=compileAll

To generate CIL on startup:
-startupcmd=CompileIL

to compile with cross reference:
-startUpCmd==compileAll_+

11 January 2011

Microsoft previews next generation ERP - Dynamics AX 6

Microsoft has released official details about Dynamics AX 6. Check the following press release for further information: Microsoft Press Release

31 August 2010

Enable Grid Filter for a Form

If you want a form to open with enabled grid filter you can use the following code in the run Method of the form
public void run()
{
    #define.strgG(2855)
    ;
    super();

    //enable Grid Filter
    this.task(#strgG);
}
Therefor the grid should be the selected control. If this isn't the case use the firstField Method of the form:
public void firstField(int _flags=1)
{
    ;
    Grid.setFocus();
}

29 July 2010

Loop through multiSelect grid selection

First of all the multiSelect property of the grid should be set to YES and if you need a button to process multiple grid selection you also should activcate the MultiSelect property of this button. Otherwise it won't be enabled.
To loop through the selected rows of the grid just use the following for statement:
void clicked()
{
    SalesLine salesLine;
    ;
    super();

    for (salesLine = SalesLine_ds.getFirst(true) ? 
                     SalesLine_ds.getFirst(true) : SalesLine_ds.cursor();
         salesLine;
         salesLine = SalesLine_ds.getNext())
    {
        salesLine.doSomethingVerySpecial(:-);
    }
    SalesLine_ds.research(true);
}

26 July 2010

SysImageRessources - Finding image ressource id

If you are looking for an Icon to display on a menuItem in an actionPane or whereever you'll need to find out the ressource id of an sysImage. To find out which images are available as ressources in Dynamics AX you should have a look at the Form SYSImageRessources Form (I always try to find it under tutorials). It shows the id, a preview of the image and the type of the image.

09 October 2009

Create a new Numbersequence for an existing Module

Although there are some good post about this online I post another short instruction bout "How to create a NumberSequence" here:
  1. create an EDT - in this Example we call it MyNewNumberSeqId
  2. Edit the loadModule Method of the NumberSeqReference_... Class of your Module add this code
    numRef.DataTypeId              = typeId2ExtendedTypeId(typeid(MyNewNumberSeqId));
    numRef.configurationKeyId      = configurationkeynum(ABCBasic);
    numRef.ReferenceHelp           = literalstr("@ABC123");
    numRef.WizardContinuous        = true;
    numRef.WizardManual            = NoYes::No;
    numRef.WizardAllowChangeDown   = NoYes::No;
    numRef.WizardAllowChangeUp     = NoYes::No;
    numRef.SortField               = 1;
    this.create(numRef);
  3. create a new method in the ParametersTable of the Module - For Example SalesParameters
    public client server static NumberSequenceReference numRefMyNewNumberSeqId()
    {
        ;
    
        return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(MyNewNumberSeqId)));
    }
  4. done
to use this NumberSequence create a numberSeq object and call its num method. I often call this method in the insert of the Datasource in which the NumberSequence is used:
public void insert()
{
    NumberSeq  numberSeq;
    ;
    if (this.MyNewNumberSeqId== "")
    {
        numberSeq = NumberSeq::newGetNum(SalesParameters::numRefMyNewNumberSeqId());
        this.MyNewNumberSeqId= numberSeq.num();
    }
    super();
}

Dynamics AX, BING & Language Translation from Arijit Basu

Found this interesting Post on Arijit Basus Blog:

Microsoft Dynamics AX: Dynamics AX, BING & Language Translation - Arijit Basu | Dynamics AX MVP

In this Post Arijit Basu describes how to interact with the BING Translation API to translate text in AX. Nice Idea :)

11 August 2009

Dynamics AX Search

Dynamics AX Suche

10 August 2009

numberSeqFormHandler

if you need to use a numberSequence in a form you can use the numberSeqFormHandler. Therefor you have to add a new method to the form an overwrite some methods of the datasource, as mentioned below. 1. Add in ClassDeclaration
NumberSeqFormHandler numberSequence; 
2. Add a new method for the numberSeqFormHandler on the form
NumberSeqFormHandler numberSeqFormHandler()
{
    if (!numberSequence)
    {
        numberSequence = numberSeqFormHandler::newForm(
            NumberSequenceReference::find(
                typeId2extendedTypeId(typeID(__EDT_NumSeqId__))).NumberSequence,
            element, __Table_DS,
            fieldNum(__Table__, __NumSeqId__));
    }
    
    return numberSequence;
}
3. Override the datasource method create() / delete() / write() / validateWrite()
public void create(boolean _append = false)
{
    super(_append);
    element.numberSeqFormHandler().formMethodDataSourceCreate();
}

public void write()
{
    ttsbegin;
    super();
    element.numberSeqFormHandler().formMethodDataSourceWrite();
    ttscommit;
}

public boolean validateWrite()
{
    boolean ret;
    ;
    ret = super();
    ret = ret && element.numberSeqFormHandler().formMethodDataSourceValidateWrite();
    return ret;
}

public void delete()
{
    ttsbegin;
    element.numberSeq().formMethodDataSourceDelete();
    super();
    ttscommit;
}

public void linkActive()
{
    element.numberSeqFormHandler().formMethodDataSourceLinkActive();
    super();
}
And remeber that continuous number sequences can only be used in transactions (between ttsbegin; and ttscommit;)