The following code will refresh the system tables in AX 2009. I had an issue with the SysClientSession table this morning and I found some documentation about from Microsoft where they suggest running a script to allow the syscronozation of systables.
The kernel uses the SYSTABVERSION parameter value in the SQL SystemVariables table to synchronize its list with the DataBase
The following were the errors I got:
1- The database reported (session 1 (-AOS-)): [Microsoft][SQL Native Client][SQL Server]Invalid object name 'SYSCLIENTSESSIONS'.. The SQL statement was: "SELECT A.SESSIONID,A.SERVERID,A.VERSION,A.LOGINDATETIME,A.LOGINDATETIMETZID,A.STATUS,A.USERID,A.SID,A.USERLANGUAGE,A.HELPLANGUAGE,A.CLIENTTYPE,A.SESSIONTYPE,A.CLIENTCOMPUTER,A.RECVERSION,A.RECID FROM SYSCLIENTSESSIONS A WHERE (SERVERID=?)"
2- Internal Error occurred executing stored procedure when creating session for the AOS.
Please backup your DB before running this script.
update SqlSystemVariables set value = value - 1 where parm = 'systabversion'
Once you do this please restart your AOS and the problem should be fixed.
Monday, September 26, 2011
Wednesday, September 14, 2011
AX 2009 Data Import / Export
The following post is about shows how to:
1- Export data from a company in AX using a definition Group
2- Creating a new company that will take the new data
3- Importing the data exported from step 1 into the new company created in step 2 using a definition group as well.
In a current project, I needed to freeze the Test1 environment due to some focus testing of a certain functionality we implemented. At the same time, we needed to allow the uses to keep testing other customizations without affecting Test1.
In addition, to make the user’s lives easier, we decided to have the same data that they were using in Test1 in our Test2 instance. So, we exported the data from our Test1 environment, and then imported it to a new company in our Test2 environment.
The following steps will show this process step by step:
1- First select the company you want to export the data from as the AX current company by clicking in company name in the right lower corner of your AX interface. 2- This would open the “Select Company” form as shown; |
3- Select Administration (module) |
4- Under periodic->Data exports /import ->Click Export to |
5- The “Export options” form will appear |
6- Select a definition group. You can either create a new definition group to include what you need, or just choose ALL to get all the tables. NOTE: In some cases, the already defined “ALL” definition group will not have all the tables, so in this case you would have to create a new definition group. In my case I created a new one name “ALL_NewDef” that included the latest tables. |
7- Enter a file name and select where to save it |
8- Click OK. At this point the company date export process should be done (after processing of course), and the files (.dat & .def) should have be saved on your computer. |
Now, let’s create a new company |
9- Make sure that the selected company empty and click area node Administration |
10- Click company Accounts under Common forms |
11- Press (Ctrl + N) in order to Create new company |
12- Make sure you select the newly created company as the current company |
Import company file already exported in the prior steps and click Administration |
13- Under periodic->Data exports /import ->Click import; The “Import options” screen will appear |
14- Select the “import definition group” drop down list and choose ALL (otherwise create your own) |
15- Select the .dat file (exported before) and Click Ok to start the process |
The import process may take some time according to the size of transactions in the original (exported) company.
In addition, you can choose to delete all the transaction data before the import when you are importing a .dat file o an existing company account to update the data.
Thursday, August 25, 2011
Application Object Server (AOS) architecture
The Application Object Server (AOS) provides the infrastructure to execute the business logic of the Microsoft Dynamics AX application. The AOS handles the required connectivity, security, and database connection management. You can install the AOS on a single computer or on multiple computers and group these computers in a load-balanced cluster.
In Microsoft Dynamics AX 2009,you can create a single cluster or multiple clusters of AOS servers.
Microsoft Dynamics AX requires Windows-integrated authentication for all servers in the system, which means that you must be running Active Directory. For security reasons, the AOS must be installed on a Windows server operating system.
A system used for demonstrations, development, or testing can be set up to use more than one AOS instance. For details about developer installations of Microsoft Dynamics AX 2009, see the Installation Guide.
In Microsoft Dynamics AX, the AOS is implemented as a Microsoft Windows
Service to take advantage of the following features:
In Microsoft Dynamics AX 2009,you can create a single cluster or multiple clusters of AOS servers.
Microsoft Dynamics AX requires Windows-integrated authentication for all servers in the system, which means that you must be running Active Directory. For security reasons, the AOS must be installed on a Windows server operating system.
A system used for demonstrations, development, or testing can be set up to use more than one AOS instance. For details about developer installations of Microsoft Dynamics AX 2009, see the Installation Guide.
In Microsoft Dynamics AX, the AOS is implemented as a Microsoft Windows
Service to take advantage of the following features:
- Windows service applications run in the security context of a specific user account that is different from any logged-on user or the default computer account. The AOS service uses a system account for authentication during start up. This account is used by the AOS to access the file server and database server.
- A Windows service application runs in its own Windows session and takes advantage of the service control manager (SCM, a feature of the Windows Server 2003 operating system or higher) to maintain status information and to provide the user interface for managing the AOS.
- Windows services can be configured to start at system startup or upon demand, and they continue to run even when no user is logged into the system.
- Server status can be reported to the Windows event log, allowing administrators to view errors and warnings that can aid in troubleshooting problems.
Wednesday, August 24, 2011
Microsoft Dynamics AX 2009 System architecture
The following post has been copied from - http://technet.microsoft.com/en-us/library/dd362112(AX.50).aspx
Microsoft Dynamics AX 2009 - Sytem architecture
Microsoft Dynamics AX 2009 - Sytem architecture
Understanding the internal architecture of Microsoft Dynamics AX can help you make decisions when planning, customizing, and deploying a system. This topic provides a high-level overview of the system architecture of Microsoft Dynamics AX.
The diagram below provides a high-level overview of Microsoft Dynamics AX system architecture. This diagram does not depict the system topology or physical infrastructure required for the deployment.
Your infrastructure can consist of many Microsoft Dynamics AX components on a single physical server or on multiple physical servers. For considerations in planning your deployment infrastructure, see Planning system topology.
For details on Microsoft Dynamics AX components, see Component architecture. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see the system requirements Web page.
.gif)
The diagram below provides a high-level overview of Microsoft Dynamics AX system architecture. This diagram does not depict the system topology or physical infrastructure required for the deployment.
Your infrastructure can consist of many Microsoft Dynamics AX components on a single physical server or on multiple physical servers. For considerations in planning your deployment infrastructure, see Planning system topology.
For details on Microsoft Dynamics AX components, see Component architecture. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see the system requirements Web page.
.gif)
Tuesday, August 23, 2011
AX 2012 - New Improvements in Data Security
The new version of AX offers many new features to all of us. These go from development improvements to data security, which is the one topic I would like to focus on in this post.
The following are the improvements with regard to data security:
Role-based security
Data security is much easier to manage. In AX 2012, users are assigned to roles based on the duties and responsibilities they have and access is granted based on those roles. This change puts an end to the tedious and time-consuming process of assigning users based on application objects. Once set up, role assignments can easily be updated based on the business data.
Server-enforced security
Authorization is performed on the server rather the client, consistently enforcing permissions on protected fields regardless of the type of client. The server sends the client only the information that the user has been granted access to, resulting in increased data security.
AX 2009 did not offer the facility to use data security based on effective date. However, in AX 2012 administrators can specify whether users have access to past, present, or future records with different levels of access, which creates much for flexibility to all the different iteration in the use of data throughout the life of the application.
Further, the new version can also be used to create data security policies based on data contained in a different table.
For example, in previous versions you could not filter sales lines by customer location because those were stored in different tables, but the new version makes that totally possible.
Data security policies are enforced at the server regardless of the type of client used to access the data.
Flexible authentication
Authentication of users by methods other than Active Directory allowing external users to access Dynamics AX without a required domain account.
The following are the improvements with regard to data security:
- Role-based security
- Server-enforced security
- Extensible data security framework
- Flexible authentication
Role-based security
Data security is much easier to manage. In AX 2012, users are assigned to roles based on the duties and responsibilities they have and access is granted based on those roles. This change puts an end to the tedious and time-consuming process of assigning users based on application objects. Once set up, role assignments can easily be updated based on the business data.
Server-enforced security
Authorization is performed on the server rather the client, consistently enforcing permissions on protected fields regardless of the type of client. The server sends the client only the information that the user has been granted access to, resulting in increased data security.
AX 2009 did not offer the facility to use data security based on effective date. However, in AX 2012 administrators can specify whether users have access to past, present, or future records with different levels of access, which creates much for flexibility to all the different iteration in the use of data throughout the life of the application.
Further, the new version can also be used to create data security policies based on data contained in a different table.
For example, in previous versions you could not filter sales lines by customer location because those were stored in different tables, but the new version makes that totally possible.
Data security policies are enforced at the server regardless of the type of client used to access the data.
Flexible authentication
Authentication of users by methods other than Active Directory allowing external users to access Dynamics AX without a required domain account.
Monday, August 22, 2011
Inside Microsoft Dynamics AX 2012 - Usability
This is a great video on AX 2012 usability. It explains the different industries where AX 212 is making a huge impact. Check it out!
https://community.dynamics.com/product/ax/axnontechnical/b/axvideos/archive/2011/08/15/inside-microsoft-dynamics-ax-2012-usability.aspx
https://community.dynamics.com/product/ax/axnontechnical/b/axvideos/archive/2011/08/15/inside-microsoft-dynamics-ax-2012-usability.aspx
Thursday, August 18, 2011
Register now to join Steve Ballmer at the Microsoft Dynamics® AX 2012 virtual launch event
Register to this free virtual event from the following link
http://www.microsoft.com/dynamics/ax2012launch/?fbid=0ufugE7brGO#register
http://www.microsoft.com/dynamics/ax2012launch/?fbid=0ufugE7brGO#register
Wednesday, August 17, 2011
Setup Electronic Format Payment (EFT) in AX 2009
A few days ago I created a new post on how to create a new Electroni Payment Format (EFT) in X++. The post can be seen here: http://axwonders.blogspot.com/2011/08/create-electronic-payment-format-ax.html
In this post I will show how to setup the EFT based on the class I created before in AX 2009.
1 - Open Accounts Payable | Setup | Payment | Methods of Payments and create a new record as follows:
NOTE: I will be using a Payment Method called EFT Mexico for this example, but you can name this anything in the Interface method in the class you will create to customize an Electronic Payment.
In the link above look at the class named KUMVendOutPaym_SA and look for a method named PaymInterfaceName. You will see the following code:
In this post I will show how to setup the EFT based on the class I created before in AX 2009.
1 - Open Accounts Payable | Setup | Payment | Methods of Payments and create a new record as follows:
NOTE: I will be using a Payment Method called EFT Mexico for this example, but you can name this anything in the Interface method in the class you will create to customize an Electronic Payment.
In the link above look at the class named KUMVendOutPaym_SA and look for a method named PaymInterfaceName. You will see the following code:
public PaymInterfaceName interfaceName()
{
;
return 'EFT Mexico';
}
Tuesday, August 16, 2011
Ax 2009 SSRS Videos
While looking for some information related to AX 2009 SSRS I found a bunch of videos related to SSRS and AX 2009.
Here is the link:
http://youtu.be/ZIoEZWaiBXI
Here is the link:
http://youtu.be/ZIoEZWaiBXI
Friday, August 12, 2011
LIKE Operator in X++
In Axapta, we can use the LIKE operator in an inline SQL statement, see the following:
select * from VendTable where VendTable.Name like 'P*'
Another example is to use the LIKE operator to compare strings!
static void MyTestForLike(Args _args)
{
str test;
;
test="Eduardo";
if(test like "Eduar*")
info('Hello Ed!');
}
select * from VendTable where VendTable.Name like 'P*'
Another example is to use the LIKE operator to compare strings!
static void MyTestForLike(Args _args)
{
str test;
;
test="Eduardo";
if(test like "Eduar*")
info('Hello Ed!');
}
Monday, August 8, 2011
Reporting & BI in AX: An Overview
The following link contains an amazing post about Reporting and BI in AX by Arijit Basu. I just felt obligated to share this great overview.
http://daxguy.blogspot.com/2008/01/reporting-bi-in-ax-overview-level-100.html
http://daxguy.blogspot.com/2008/01/reporting-bi-in-ax-overview-level-100.html
Monday, August 1, 2011
Create Electronic Payment Format - AX 2009
Electronic payments are being used heavily today. It is importnat to understand how these work and how to implement them as they save lots of time and even more paperwork. In addition, AX 2009 provides some out-of-the-box payment templates, but they are not very felxible and very often we need to create our own.
Now the good thing about creating our own is that we can inherit from two base classes. (1) VendOutPaym and (2) VendOutPaymRecord.
VendOutPaym is ussually used to create the header and closing records of a payment file. On the other hand, VendOutPaymRecord is used to create the the lines records of the payment file. So, if we have a payment journal (AP > Journals > Payments> Payment Journal) with 10 lines, we should see only one header line, (in my case) only one Bank line (after header), 10 line records (Payment journal lines) and one closing line with totals, got the idea?
So, we would have to create two classes. One to write the header and closing records and one to write the journal lines, ok?
Here is the first class to write header and closing records. Because in my file the empey spaces needed to be filled with only 0's, I created a method that's called getProcessedStr that takes a string and an integer. The string is the actual value that will be written into the file but needs extra 0's. The int is the total lenght of this record in the text file.
Now the good thing about creating our own is that we can inherit from two base classes. (1) VendOutPaym and (2) VendOutPaymRecord.
VendOutPaym is ussually used to create the header and closing records of a payment file. On the other hand, VendOutPaymRecord is used to create the the lines records of the payment file. So, if we have a payment journal (AP > Journals > Payments> Payment Journal) with 10 lines, we should see only one header line, (in my case) only one Bank line (after header), 10 line records (Payment journal lines) and one closing line with totals, got the idea?
So, we would have to create two classes. One to write the header and closing records and one to write the journal lines, ok?
Here is the first class to write header and closing records. Because in my file the empey spaces needed to be filled with only 0's, I created a method that's called getProcessedStr that takes a string and an integer. The string is the actual value that will be written into the file but needs extra 0's. The int is the total lenght of this record in the text file.
Wednesday, July 27, 2011
strRem Function - Delete a Character from String - AX 2009
The following code searches a specified string character and deletes it. The cool thing about this function is that it is case sensitive.
For example:
str strRem(str text1, str text2)
text1 The string from which to remove characters.
text2 The characters to exclude from the output string.
strRem("MynameIs","is"); //Returns the string "MynameI".
Tuesday, July 26, 2011
Get the length of a string in x++
str _myString = '123456789';
int _len;
;
len = strlen(myString);
info(strfmt('%1', len);
returns 9
int _len;
;
len = strlen(myString);
info(strfmt('%1', len);
returns 9
Wednesday, July 20, 2011
Create Electronic Invoice to Text File Format - Ax 2009 -
The following code is to create a company country specific requirement. In addition, the logic is specific to the needs of my customer, but I'm sure you will be able to find great examples on how to create directories with WinApi and manipulate text files with the TextIO function.
The project flow is as follow:
1- The user posts an invoice
2- After the invoice has been posted, the KMN_eInvoiceCreation class is called with parameters (This call is not posted here)
3- The class has several methods from creating the path file name, to writing a very specific logic into a text file.
4- The class saves the file into a specific location
The project produces the following text file contents:
DC|3.0|||15/07/2011|Pago en una sola exhibición||150.22|||||270.02||I
EM|KIE9512187VA|Compania de Ventanas S.A.
DF|Juytyu|130|Piso 7 y 8, Desp.801|Lostre|||MiguelHidalgo|DF|Mexico|999
RC|TORE621221HP9|Elizabeth Araya Reyes
DM|Teaneck|308||Warrrr|||Guadalupe|NL|Mexico|986589
CN|1.00|||Libro de Respuestas 3A/2A/A|25.00|25.00
CN|1.00|||Diploma de Finalización 7A|2.61|2.61
CN|1.00|||Diploma de Finalización 6A|2.61|2.61
CN|1.00|||Flashcards 1-50|120.00|120.00
IA|102433660003476|08/10/2010|Laredo
IT|IVA|33.80|16.00
TI||33.80
This project uses a custom table to store all the SalesParmTable data as we needed to provide a way for the user to re-run a posted invoice.
The following are the base enums I'm using.
The project flow is as follow:
1- The user posts an invoice
2- After the invoice has been posted, the KMN_eInvoiceCreation class is called with parameters (This call is not posted here)
3- The class has several methods from creating the path file name, to writing a very specific logic into a text file.
4- The class saves the file into a specific location
The project produces the following text file contents:
DC|3.0|||15/07/2011|Pago en una sola exhibición||150.22|||||270.02||I
EM|KIE9512187VA|Compania de Ventanas S.A.
DF|Juytyu|130|Piso 7 y 8, Desp.801|Lostre|||MiguelHidalgo|DF|Mexico|999
RC|TORE621221HP9|Elizabeth Araya Reyes
DM|Teaneck|308||Warrrr|||Guadalupe|NL|Mexico|986589
CN|1.00|||Libro de Respuestas 3A/2A/A|25.00|25.00
CN|1.00|||Diploma de Finalización 7A|2.61|2.61
CN|1.00|||Diploma de Finalización 6A|2.61|2.61
CN|1.00|||Flashcards 1-50|120.00|120.00
IA|102433660003476|08/10/2010|Laredo
IT|IVA|33.80|16.00
TI||33.80
This project uses a custom table to store all the SalesParmTable data as we needed to provide a way for the user to re-run a posted invoice.
The following are the base enums I'm using.
Friday, July 15, 2011
SubStr function - Axapta
str SubStr (str _text, int _position, int _chars)
SubStr("MyString",20,3); // Returns ""
SubStr("MyString ",4,50); // Returns "tring"
Monday, July 11, 2011
Create loop from an AX form DataSet - Ax 2009
Sometimes we need to loop through values at the form level. The following code loops (for loop) the SalesParmTable in the CloseOk() Form method.
//Create Lines
for (localSalesParmTable = salesParmTable_ds.getFirst();
localSalesParmTable;
localSalesParmTable = salesParmTable_ds.getNext())
{
....Implementation....
}
//Create Lines
for (localSalesParmTable = salesParmTable_ds.getFirst();
localSalesParmTable;
localSalesParmTable = salesParmTable_ds.getNext())
{
....Implementation....
}
Code to check for "garbage" in the ReleaseUpdateScripts table - AX 2009
ReleaseUpdateScripts releaseUpdateScripts;
Counter total;
Counter invalid;
;
while select ClassID
from releaseUpdateScripts
group by ClassID
{
total++;
if (classid2name(releaseUpdateScripts.ClassID) == '')
{
info(int2str(releaseUpdateScripts.ClassID));
invalid++;
}
}
info(strfmt(@"Found %1 invalid classIds out of %2", invalid, total));
Counter total;
Counter invalid;
;
while select ClassID
from releaseUpdateScripts
group by ClassID
{
total++;
if (classid2name(releaseUpdateScripts.ClassID) == '')
{
info(int2str(releaseUpdateScripts.ClassID));
invalid++;
}
}
info(strfmt(@"Found %1 invalid classIds out of %2", invalid, total));
Wednesday, July 6, 2011
Workaround to Exception::CLRError using System.IO.StreamWriter
In one of my projects I was using the System.IO.StreamWriter to write data into a text file in X++. Everything went well until I started testing for exception in order to handle them (the System.IO is a .Net class that allows us to maniluplate file operations, including folders. So, I though in catching the exception with the Exception::CLRError one. )
The problem I was having was that when an exception was raised by a problem creating the file (Incorrect file name), the operation will not fall into the Exception::CRLError exception, Instead, it would just crash and I wasn't able to properly handle the exception.
The reason for this is that when using an AX class that runs on the server, the exception never comes back to the client and therefore cannot be handled correctly. I'm using the SalesFormLetter class main method to call my own class after an invoice is generated, and this class (SalesFormLetter) is (1) an abstract class and (2) runs on the server and I really did not want to do this.
A workaorund is to use the TextIO class in AX along with the FileIoPermission. For example, when using the TextIo to create (and/or overwrite) a file, we get a null value when the file could not be created (and/or overwritten). Then, we can throw an exception when the object is null.
In my case I have a central class that handles all errors, so when the TextIO object is null, I call this class and I throw an error, then the error comes back to my method and falls into the Exception::Error exception.
The following is the code
The problem I was having was that when an exception was raised by a problem creating the file (Incorrect file name), the operation will not fall into the Exception::CRLError exception, Instead, it would just crash and I wasn't able to properly handle the exception.
The reason for this is that when using an AX class that runs on the server, the exception never comes back to the client and therefore cannot be handled correctly. I'm using the SalesFormLetter class main method to call my own class after an invoice is generated, and this class (SalesFormLetter) is (1) an abstract class and (2) runs on the server and I really did not want to do this.
A workaorund is to use the TextIO class in AX along with the FileIoPermission. For example, when using the TextIo to create (and/or overwrite) a file, we get a null value when the file could not be created (and/or overwritten). Then, we can throw an exception when the object is null.
In my case I have a central class that handles all errors, so when the TextIO object is null, I call this class and I throw an error, then the error comes back to my method and falls into the Exception::Error exception.
The following is the code
Wednesday, June 15, 2011
Mark Customer Invoices for settlement with AX 2009 - Mark Invoices
After creating a payment journal (http://axwonders.blogspot.com/2011/06/create-axapta-payment-journal.html ), you might want to mark the invoices for settlement. This task is done by looping through the just created Payment Journal and then by querying the CustTransOpen Table and instantiating the CustTrans table from the CustTransOpen.CustTrans() method.
The following is the code to mark invoices. Also, the code loops through each payment journal transaction.
Also, the logic behind it is that the SpecTrans table needs to have two records in order to offset an open invoice with a transaction. So the code below inserts two records to the SpecTrans table. One is for all the open transactions (invoices - Sales) and the other is for all the payment transactions (paymet - Payment)
For example:
select firstonly invCustTrans where invCustTrans.AccountNum == custTable.AccountNum
&& invCustTrans.TransType == LedgerTransType::Sales
&& !invCustTrans.LastSettleDate;
the code above will select all the customer transactions with a TransType of Sales.
On the other hand, the code below will select all the customer transaction with a TransType of Payment.
select firstonly payCustTrans where payCustTrans.AccountNum == custTable.AccountNum
&& payCustTrans.TransType == LedgerTransType::Payment
&& !payCustTrans.LastSettleDate;
Then we need to insert the two instances of CustTrans into the SpecTrans table:
specOffsetVoucher.insert(invCustTrans.dataAreaId, invCustTrans.TableId, invCustTrans.RecId, invCustTrans.AmountCur, invCustTrans.CurrencyCode, NoYes::No);
specOffsetVoucher.insert(payCustTrans.dataAreaId, payCustTrans.TableId, payCustTrans.RecId, payCustTrans.AmountCur, payCustTrans.CurrencyCode, true);
The following is the whole code:
The following is the code to mark invoices. Also, the code loops through each payment journal transaction.
Also, the logic behind it is that the SpecTrans table needs to have two records in order to offset an open invoice with a transaction. So the code below inserts two records to the SpecTrans table. One is for all the open transactions (invoices - Sales) and the other is for all the payment transactions (paymet - Payment)
For example:
select firstonly invCustTrans where invCustTrans.AccountNum == custTable.AccountNum
&& invCustTrans.TransType == LedgerTransType::Sales
&& !invCustTrans.LastSettleDate;
the code above will select all the customer transactions with a TransType of Sales.
On the other hand, the code below will select all the customer transaction with a TransType of Payment.
select firstonly payCustTrans where payCustTrans.AccountNum == custTable.AccountNum
&& payCustTrans.TransType == LedgerTransType::Payment
&& !payCustTrans.LastSettleDate;
Then we need to insert the two instances of CustTrans into the SpecTrans table:
specOffsetVoucher.insert(invCustTrans.dataAreaId, invCustTrans.TableId, invCustTrans.RecId, invCustTrans.AmountCur, invCustTrans.CurrencyCode, NoYes::No);
specOffsetVoucher.insert(payCustTrans.dataAreaId, payCustTrans.TableId, payCustTrans.RecId, payCustTrans.AmountCur, payCustTrans.CurrencyCode, true);
The following is the whole code:
Monday, June 13, 2011
Create Axapta Payment Journal
The following code creates a payment journal in AX.
There are some methods calls in the previous code. These are the following:
NOTE: I'm using accessory methods for most of the variables in this code (this is a class), so remember to declare them in the classDeclaration and create your own properties.
public void PaymentJournalLineCreation()
{
boolean ret;
CustTable custTable;
LedgerJournalName LedgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberseq;
;
//Get customer account
this.getCustomerAccount();
//Get currency
this.setCurrency();
//Set JournalNameId
this.setJournalNameId(LedgerJournalACType::Bank);
//Get table buffer
custTable = CustTable::find(customerAccount, false);
// Find a ledgerJournalName record
select firstonly LedgerJournalName
where LedgerJournalName.JournalName == journalNameId;
//Get next available voucher number
numberseq = NumberSeq::newGetVoucherFromCode(LedgerJournalName.VoucherSeries);
ledgerJournalTrans.Voucher = numberseq.voucher();
//Generate the transaction line
ledgerJournalTrans.JournalNum = ledgerJournalId;
ledgerJournalTrans.CurrencyCode = currencyCode;
ledgerJournalTrans.ExchRate = Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = customerAccount;
ledgerJournalTrans.accountName();
ledgerJournalTrans.AccountType = LedgerJournalACType::Cust;
ledgerJournalTrans.Dimension[1] = custTable.Dimension[1];
LedgerJournalTrans.KUMTeamDescription();
ledgerJournalTrans.Dimension[2] = custTable.Dimension[2];
ledgerJournalTrans.KUMDetailDescription();
ledgerJournalTrans.Dimension[3] = custTable.Dimension[3];
ledgerJournalTrans.KUMEventDescription();
ledgerJournalTrans.AmountCurCredit = paymentAmount;
ledgerJournalTrans.TransDate = PaymentDate;
ledgerJournalTrans.Txt = '@COL1576'; //Payment, Thank you
ledgerJournalTrans.PaymMode = custTable.PaymMode;
ledgerJournalTrans.PostingProfile = 'DFLT';
ledgerJournalTrans.BankTransType = 'Chck-rcpt';
ledgerJournalTrans.Payment = custTable.PaymTermId;
ledgerJournalTrans.CustVendBankAccountId = this.GetCustomerBankAccountID(customerAccount);
ledgerJournalTrans.SettleVoucher = SettlementType::OpenTransact;
ledgerJournalTrans.TransactionType = LedgerTransType::Payment;
ledgerJournalTrans.Approved = NoYes::Yes;
ledgerJournalTrans.ApprovedBy = curUserId();
ledgerJournalTrans.Due = systemdateget();
ledgerJournalTrans.TaxGroup = 'DFLT';
ledgerJournalTrans.OffsetAccount = bankAccount;
ledgerJournalTrans.OffsetAccountType = LedgerJournalACType::Bank;
ledgerJournalTrans.offsetAccountName();
ledgerJournalTrans.PaymentStatus = CustVendPaymStatus::None;
ledgerJournalTrans.insert();
}
//Find customer account based on Customer Reference Number
public CustAccount getCustomerAccount()
{
CustAccount custAccount;
CustBankAccount custBankAccount;
int countRecords = 0;
;
switch (JournalFormatType)
{
case KMN_CustPaymentJournalFormatType::Mexico:
select * from custBankAccount where custBankAccount.MsgToBank == customerReference;
custAccount = custBankAccount.CustAccount;
this.parmCustAccount(custAccount);
break;
}
return custAccount;
}
//Sets the currency value to the property
public void setCurrency()
{
;
//Set property
this.parmCurrencyCode(CompanyInfo::standardCurrency());
}
public void setJournalNameId(LedgerJournalACType _journalType)
{
LedgerJournalNameId _journalNameId;
;
switch(_journalType)
{
case LedgerJournalACType::Bank:
_journalNameId = 'CR';
break;
}
this.parmLedgerJournalNameId(_journalNameId);
}
NOTE: I'm using accessory methods for most of the variables in this code (this is a class), so remember to declare them in the classDeclaration and create your own properties.
Tuesday, June 7, 2011
Using Args for Output and Display Menuitems - AX 2009
public static void main(Args args)
{
VendPurchOrderJour vendPurchOrderJour;
PurchTable purchTable;
;
if(args.dataset() == tablenum(VendPurchOrderJour))
{
vendPurchOrderJour = args.record();
select purchTable where purchTable.PurchId == vendPurchOrderJour.PurchId;
if(purchTable.CustomsImportOrder_IN == noYes::Yes)
new MenuFunction(menuitemoutputstr(TestPurch), MenuItemType::Output).run(args);
else
new MenuFunction(menuitemoutputstr(TestS), MenuItemType::Output).run(args);
}
}
{
VendPurchOrderJour vendPurchOrderJour;
PurchTable purchTable;
;
if(args.dataset() == tablenum(VendPurchOrderJour))
{
vendPurchOrderJour = args.record();
select purchTable where purchTable.PurchId == vendPurchOrderJour.PurchId;
if(purchTable.CustomsImportOrder_IN == noYes::Yes)
new MenuFunction(menuitemoutputstr(TestPurch), MenuItemType::Output).run(args);
else
new MenuFunction(menuitemoutputstr(TestS), MenuItemType::Output).run(args);
}
}
RAID in AX 2009 - AX 2009
With an ERP system such as Microsoft Dynamics AX 2009, the database server generally stores a very large amount of important data for the business. If this data is unavailable for any length of time, the business could experience
significant financial losses.
Using a Redundant Array of Independent Disks (RAID) can help reduce the possibility of this loss occurring. Another important aspect for a database server is fine tuning for optimal performance. A RAID disk subsystem can also be used to help achieve this goal.
RAID refers to a group of two or more disks managed as a single unit to store the data together with additional, or redundant, information to provide recovery if there is a disk failure.
Usually a failed disk in a RAID system can be replaced while the server is still running. This is one benefit of RAID.
significant financial losses.
Using a Redundant Array of Independent Disks (RAID) can help reduce the possibility of this loss occurring. Another important aspect for a database server is fine tuning for optimal performance. A RAID disk subsystem can also be used to help achieve this goal.
RAID refers to a group of two or more disks managed as a single unit to store the data together with additional, or redundant, information to provide recovery if there is a disk failure.
Usually a failed disk in a RAID system can be replaced while the server is still running. This is one benefit of RAID.
Managing Multiple AOS Instances - AX 2009
When multiple instances are installed, use the Microsoft Dynamics AX Server Configuration utility to manage all AOS instances. Use the Server Configuration utility to verify that the AOS connects to the correct database and application file server.
1. Open the Server Configuration utility (Start > Administrative Tools > Microsoft Dynamics AX Server Configuration).
2. Click Manage, click Create configuration, and then enter a name for the configuration. Then determine whether to copy it from the active or original configuration.
3. On the Application Object Server tab, validate that the Application file location is correct.
4. In the TCP/IP port field, note which port the AOS is running on.This information is needed to connect to the AOS.
5. On the Database tab, validate that the AOS is connected to the correct database. If not, change it.
6. Click OK to exit the configuration utility
1. Open the Server Configuration utility (Start > Administrative Tools > Microsoft Dynamics AX Server Configuration).
2. Click Manage, click Create configuration, and then enter a name for the configuration. Then determine whether to copy it from the active or original configuration.
3. On the Application Object Server tab, validate that the Application file location is correct.
4. In the TCP/IP port field, note which port the AOS is running on.This information is needed to connect to the AOS.
5. On the Database tab, validate that the AOS is connected to the correct database. If not, change it.
6. Click OK to exit the configuration utility
Connect to a new AOS Instance - AX 2009
Follow these steps to connect a client to a new AOS instance:
1. Open the Microsoft Dynamics AX Client Configuration utility
(Start > Control Panel > Administrative Tools > Microsoft Dynamics AX Configuration Utility).
2. In the Configuration target list, select Local client.
3. Click Manage, click Create configuration, and then enter a name for the configuration. Then determine whether to copy it from the active or original configuration.
4. On the Connection tab, click New. Enter the Server name, Instance name, and TCP/IP port of the AOS instance to connect to, and then click OK and exit the configuration utility.
1. Open the Microsoft Dynamics AX Client Configuration utility
(Start > Control Panel > Administrative Tools > Microsoft Dynamics AX Configuration Utility).
2. In the Configuration target list, select Local client.
3. Click Manage, click Create configuration, and then enter a name for the configuration. Then determine whether to copy it from the active or original configuration.
4. On the Connection tab, click New. Enter the Server name, Instance name, and TCP/IP port of the AOS instance to connect to, and then click OK and exit the configuration utility.
Create a Proxy Business Connector Account in active directory - AX 2009
Create the proxy account in Active Directory as follows:
1. Create a unique user in Active Directory in the form domain\username, for example, domain\bcproxy. This user must not have the same name as an existing Microsoft Dynamics AX user. For the procedure to add a new user, see the Active Directory documentation.
2. Assign a password to the user.
3. Select the Password does not expire option.
4. Select the No interactive logon rights option.
5. Close Active Directory
1. Create a unique user in Active Directory in the form domain\username, for example, domain\bcproxy. This user must not have the same name as an existing Microsoft Dynamics AX user. For the procedure to add a new user, see the Active Directory documentation.
2. Assign a password to the user.
3. Select the Password does not expire option.
4. Select the No interactive logon rights option.
5. Close Active Directory
Macros in AX 2009 - AX 2009
Macros are constants, or pieces of code, that are being taken care of by the compiler before the rest of the code to replace the code where the macro is used with the content of the macro.
There are three different types of macros: stand alone macros, local macros, and macro libraries.
Macros are typically constant values that are only changed by developers. They are used so that developers don't have to hardcode these kind of values in the X++ code, but rather refer to the macro.
There are three different types of macros: stand alone macros, local macros, and macro libraries.
Macros are typically constant values that are only changed by developers. They are used so that developers don't have to hardcode these kind of values in the X++ code, but rather refer to the macro.
Inheritance in AX - AX 2009
One of the central concepts of object-oriented programming is the possibility to inherit functionality defined at a higher level in the system. This can be done by having a class hierarchy where a method in a subclass overrides a method in the super class (higher level).
The method in the subclass can still use the functionality in the same method in the super class by using the super function as in this example:
The method in the subclass can still use the functionality in the same method in the super class by using the super function as in this example:
Friday, May 13, 2011
Deploy AX 2009 from Terminal Services with the AX configuration - AX 2009
In my company we were trying to deploy AX 2009 from terminal services and we encountered profiles issues when other users (other than the server admin or domain admin) were trying to access the application.
This was strange as we did install the client on a public share, and we also imported the correct configuration for the AX 2009 client.
Anyway, I need to give full credit to my company's System Manager. His name is Rohan Robinson and he is truly a master when it comes to Terminal Services and Citrix. His email is rrobinson@argointl.com in case you have questions for him.
So, Rohan came up with the following solution:
1- He installed the AX client on a public share
2- Imported the correct configuration for the client. In here make sure that the configuration file has the correct path as shown below:
3- Moved the configuration file to the bin folder (E:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin)
4- Modified the properties in terminal services to point to the axc file instead of the AX32.exe file. The process is as follow:
*Right-Click on the AX remote App on the Terminal Services UI as shown:
*Then change the path with the configuration file name (which is already in E:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin) instead of the AX32.exe one as shown below:
At this point, everybody can access the application through terminal services. Rohan also mentioned that the same process can be used in Citrix (XenApp 6.0).
Thanks!
This was strange as we did install the client on a public share, and we also imported the correct configuration for the AX 2009 client.
Anyway, I need to give full credit to my company's System Manager. His name is Rohan Robinson and he is truly a master when it comes to Terminal Services and Citrix. His email is rrobinson@argointl.com in case you have questions for him.
So, Rohan came up with the following solution:
1- He installed the AX client on a public share
2- Imported the correct configuration for the client. In here make sure that the configuration file has the correct path as shown below:
3- Moved the configuration file to the bin folder (E:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin)
4- Modified the properties in terminal services to point to the axc file instead of the AX32.exe file. The process is as follow:
*Right-Click on the AX remote App on the Terminal Services UI as shown:
*Then change the path with the configuration file name (which is already in E:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin) instead of the AX32.exe one as shown below:
At this point, everybody can access the application through terminal services. Rohan also mentioned that the same process can be used in Citrix (XenApp 6.0).
Thanks!
Friday, May 6, 2011
Error while trying to access Active Directory - AX 2009 -
Today I was trying to add some users by using the Microsoft Dynamics AX 2009 Active Directory Import Wizard and I got the following error:
Error while trying to access Active Directory
I went into a code (Forms/SysUserADUserImportWizard/searchADUser) and I saw that the Active Directory searcher will break into this line:
searchResultCollection = directorySearcher.FindAll();
Error while trying to access Active Directory
I went into a code (Forms/SysUserADUserImportWizard/searchADUser) and I saw that the Active Directory searcher will break into this line:
searchResultCollection = directorySearcher.FindAll();
Tuesday, April 26, 2011
Best Practice Check execution - Multisite in AX 2009 - Specific Checks - Tables - Inventory dimension fields are handled by multisite activation
When upgrading from an older version to AX 2009, the multisite function is, by default, inactive. Ususally when you activate Multisites in AX 2009, you may have an error message saying:
"The Multisite wizard is not up-to date"
This means that some new InventDim fields have been added to some tables and the wizard cannot run. There are many ways to fix this, but I found that by executing a Best Practice Check is the best way to do this.
On the Microsoft white paper about multisites (http://www.ax-pact.com/downloads/Multisite%20Activation%20White%20Paper%20for%20Microsoft%20Dynamics%20AX%202009%20.pdf) they suggest doing this, but they don't tell you where to run the Best Practices Check from.
To do so follow the next steps:
"The Multisite wizard is not up-to date"
This means that some new InventDim fields have been added to some tables and the wizard cannot run. There are many ways to fix this, but I found that by executing a Best Practice Check is the best way to do this.
On the Microsoft white paper about multisites (http://www.ax-pact.com/downloads/Multisite%20Activation%20White%20Paper%20for%20Microsoft%20Dynamics%20AX%202009%20.pdf) they suggest doing this, but they don't tell you where to run the Best Practices Check from.
To do so follow the next steps:
Tuesday, April 19, 2011
Consume an Currency Exchange Rates Web Service from AX 2009 - WFC
Consuming web services from Ax 2009 is a sort of tricky task when the web service is not DAX 2009 "friendly".
Microsoft published a white paper on how to consume a web service to load currency exchange rates into the ExchRates Tables. The problem is that the web service provider's information is outdated. In addition, this white paper does not really explain the problem the developer will faced when the URL does not have the WSDL definition into it.
For example, in the white paper the web service URL is the following:
Microsoft published a white paper on how to consume a web service to load currency exchange rates into the ExchRates Tables. The problem is that the web service provider's information is outdated. In addition, this white paper does not really explain the problem the developer will faced when the URL does not have the WSDL definition into it.
For example, in the white paper the web service URL is the following:
Tuesday, March 29, 2011
Lightswitch "How Do I?" Videos - Visual Studio Lightswitch
A few weeks ago I downloaded Visual Studio Lightswitch. I'm still getting to know the application and new features that are offered by Microsoft. You can have a full definition of Visual Studio Lightswitch here:
https://community.altiusconsulting.com/blogs/mikevinson/archive/2010/11/09/microsoft-visual-studio-lightswitch-what-is-it.aspx
I do have to say that the development of business applications has been taken to the next step. I think the most interesting aspect of Visual Studio Lightswitch is that we can now develop apps for the cloud. This is really interesting to me as I'm getting into SharePoint development and I just read that Microsoft will have the Office 365 available really soon.
Anyway the Silverlight team has some interesting tutorials about developing data-centered silverlight apps for the web by using Visual Studio LightSwitch. You can find it here:
http://team.silverlight.net/announcement/announcing-visual-studio-lightswitch-beta-2-is-available/
Also, the MSDN LightSwitch has some easy to understand How Do I videos around Visual Studio LightSwitch here:
http://msdn.microsoft.com/en-us/lightswitch/gg604823
https://community.altiusconsulting.com/blogs/mikevinson/archive/2010/11/09/microsoft-visual-studio-lightswitch-what-is-it.aspx
I do have to say that the development of business applications has been taken to the next step. I think the most interesting aspect of Visual Studio Lightswitch is that we can now develop apps for the cloud. This is really interesting to me as I'm getting into SharePoint development and I just read that Microsoft will have the Office 365 available really soon.
Anyway the Silverlight team has some interesting tutorials about developing data-centered silverlight apps for the web by using Visual Studio LightSwitch. You can find it here:
http://team.silverlight.net/announcement/announcing-visual-studio-lightswitch-beta-2-is-available/
Also, the MSDN LightSwitch has some easy to understand How Do I videos around Visual Studio LightSwitch here:
http://msdn.microsoft.com/en-us/lightswitch/gg604823
Monday, March 28, 2011
Find AOT classes through X++
Today I needed to implement a job that existed my company's old version of AX into AX 2009. In the Old Axapta I went to Basic > Batch List to find the name of the job and/or the date it was created.
Then I went to the AOT > Data Dictionary > Tables > Batch and I opened the table by using the table browser and I saw that the Class ID for this particular Job was 40144.
Then I created a new job and I wrote the following code:
static void ClassNames(Args _args)
{
DictClass dictclass;
;
dictclass = new DictClass(40144);
info(dictclass.name());
}
The info log showed me the name of class that is run by the AX Job. From there I just created a new batch record to run it every night.
Then I went to the AOT > Data Dictionary > Tables > Batch and I opened the table by using the table browser and I saw that the Class ID for this particular Job was 40144.
Then I created a new job and I wrote the following code:
static void ClassNames(Args _args)
{
DictClass dictclass;
;
dictclass = new DictClass(40144);
info(dictclass.name());
}
The info log showed me the name of class that is run by the AX Job. From there I just created a new batch record to run it every night.
Subscribe to:
Posts (Atom)