This post is machine-translated. The original post in german language can be found here.

AX 2012: SysOperation-Framework: Initalize parameters of a data contract

If you include the SysOperationInitializable class in a data contract using the implements command, the method initialize() gets available and can be overwritten.

This method can be used to initialize variables within the data contract. However, this method is only called as long as no usage data is found or it is not activated.

[DataContractAttribute]
class TutorialSysOperationDataContract
    implements SysOperationInitializable
{
    date dialogDate;
}

 

[DataMemberAttribute]
public TransDate parmDialogDate(TransDate _dialogDate = dialogDate)
{
    dialogDate = _dialogDate;
    return dialogDate;
}

 

public void initialize()
{
    dialogDate = systemDateGet() - 365;
}

 

If you want the initalize() to always be called, you must extend the DataContract with the attribute SysOperationAlwaysInitializeAttribute.

[DataContractAttribute, SysOperationAlwaysInitializeAttribute]
class TutorialSysOperationDataContract
    implements SysOperationInitializable
{
    date dialogDate;
}
These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
März 2024
MoTuWeThFrSaSu
 123
45678910
11121314151617
18192021222324
25262728293031
 
© 2006-2024 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.