RSS

Tag Archives: AX 2012

Split the string value by using saperatror in AX


static void StringSplitter(Args _args)

{
GeneralJournalAccountEntry generalJournalAccountEntry;
TextBuffer buffer;
str value;
Counter cnt;

value = “1000-524-457-524”;
//select generalJournalAccountEntry;
buffer = new TextBuffer();
buffer.setText(value);//generalJournalAccountEntry.LedgerAccount);

while (buffer.nextToken(0, ‘-‘))
{
cnt++;

if(cnt == 1)
info (strFmt(“first %1”,buffer.token()));
if(cnt == 2)
info (strFmt(“two %1”,buffer.token()));
if(cnt == 3)
info (strFmt(“three %1”,buffer.token()));
if(cnt == 4)
info (strFmt(“four %1”,buffer.token()));

}
}

 
Leave a comment

Posted by on September 29, 2015 in AX 2012

 

Tags:

Some issues during changing index uniqueness


Some issues during changing index uniqueness

Some times we need to create a new unique index or alter existing one, but table may already contain duplicate data for this index and our changes could not be applied until data in table fixed to support uniqueness. We could do it by deleting records in the table but due to huge number of companies in environment it could be time consuming. To save your time you could use following job:

static void ChangingIndex(Args _args)
{
    MyTable myTable;
    DataArea dataArea;
    int count;
    ;
    ttsbegin;
    while select dataArea
    {
        count = 1;
        changecompany(dataArea.Id)
        {
            myTable = null;
            while select forupdate myTable
            {
                count ++;
                myTable.FieldForUniqueness = int2str(count);
                myTable.update();
            }
        }
    }
    ttscommit;
}

Another way to solve this problem is to make following steps:

  1. Try to synchronize your table
  2. You get an error saying that there are duplicates
  3. Rright away you go to Administration > Periodic > SQL Administration form.
  4. Select your table in the list and run Table actions > Check/Synchronize command.
  5. In appeared form enable “Check Allow duplicated’” and run.
  6. You will get a list of conflicting records to kill.

Reference : Dynamicsaxtraining.

 
Leave a comment

Posted by on September 23, 2015 in AX 2012

 

Tags:

Any currency to accounting currency in AX 2012


Any currency to accounting currency in AX 2012

Currency::amount(markupTransAllocate.Value, markupTransAllocate.CurrencyCode);

Regards

Arun
 
Leave a comment

Posted by on September 23, 2015 in AX 2012

 

Tags:

Adding text translations to entities using X++


AX2012 : Adding text translations to entities using X++ [Technical walk-through]

Hi Friends,
Microsoft dynamics AX provides text translation possibilities on some standard entities like products, ledger accounts, financial dimension and few more. Text translations are displayed on documents where a language code is applied for example packing slips and invoices. Also, when the system language for the user corresponds to the translations, the translations are displayed in Enterprise Portal for Microsoft Dynamics AX.

A simple way to store the translations is to open the translations form , select the translation language and then save the translated text. For example to store translations for a product name, open the translations screen from product list page as shown below :

Select the language from the drop down which comes on clicking on the + button
Enter and save the translated text.
There can be instances where you want to extend this capability to other existing or new entities in the system to make your solution flexible and rich. From technical point of there is a standard AX class called SysTransalationHelper which provides capabilities to achieve this. In order to understand how we can use this class, let’s do a quick walk-through and extend the standard AX’s Questionnaire entity to have ability to set-up text translation.
The standard AX form for questions can be found at Home >> Common >> Questionnaires >> Design >> Questions
PS –> For demonstration purpose, I am just creating the minimum required methods and objects. In real time make sure you follow development best practise recommendations. I will be prefixing new objects with DEM_ to distinguish from standard AX objects.
Step 1 : Create a new table. I called it DEM_KMQuestionTranslation. Now add 2 foreign key relations as shown below, one relation with KMQuestion table and another with LanguageTable. KMQuestion table stores the Questions information and the Language table is used to store list of all languages available on the system. Additionally add a Description field. The table structure should look as shown below:
Add the below 2 methods in this table:
createOrUpdateTransalation() –> This method is used to create or update a question translation record. The implementation is quite straightforward. Refer to standard AX method \Data Dictionary\Tables\EcoResProductTranslation\Methods\createOrUpdateTranslation() to view a similar implementation.
findByQuestionLanguage() –> This method is used to find the specified record in the DEM_KMQuestionTranslation table by using the specified question language. Similar standard AX method implementation can be found at \Data Dictionary\Tables\EcoResProductTranslation\Methods\findByProductLanguage()
Step 2: Now we need to add below line of code in standard AX KMQuestion table insert() method. This is to create a default translation record in our new table whenever a new question record is created in the system.
Step 3 : Now we need to create a new class. Let’s call this class DEM_QuestionnairesTranslationHelper  and add couple of methods as shown below:
Class declaration , declare two variables as shown below
Create parm methods to get and set the values
Now here comes the interesting part. Create a method to construct a new object of SysTransalationHelper class and use the tablenum of the main entity table and the new table which is storing the language translation details as shown below
Secondly create a method to launch the translation detail form. To do this we need to create a method as shown below which uses SysTranslationHelper class object as a parameter and calls it’s launch translation form method:
The last method required in this class is to instantiate the class . To do this create a new method as shown below:
Step 4 : Now we create a new menu item for this class
Step 5 : Plug this menu item on the questions form as shown below:
We are done and ready to test drive this. Now on opening the Questions form we can see the transalations button . When we click it,system launches the translation helper form where we can store our translated texts using all standard AX functions as shown below:
You can also download the XPO from  HERE to have quick access to code.

So in this post we saw how we can make our solutions flexible and more intuitive by adding the translation texts capabilities to any existing or new entities.

Thanks for reading the blog.

 
Leave a comment

Posted by on September 10, 2015 in AX 2012

 

Tags: ,

Importing purchase orders using DIXF AX 2012


In this post we will illustrate how to import purchase orders through data import export framework. we will use one excel file which contain purchase order header in first sheet and purchase order details in another sheet.

To import the purchase order please do the following steps:

1- Go to Data import export framework –> Setup –> Data import / export framework Parameters.

2- Click browse to select shared working directory then click Validate button then close the form.

3- Go to Data import export framework –> Setup –> Source Data format, Create new source name and make sure to chose File in the Type field then select the file format in my example i will use excel.

4- Go to Data import export framework –> Common –> Processing Group, Create New Group then Click the Entities Button.

5- in the entities form select the Purchase Order Header Entity,select Excel in the Source data format, then Click the generate source file button.

6- In the wizard click next then Make sure to select the following fields:
CurrencyCode
InvoiceAccount
LanguageId
OrderAccount
PurchId
VendGroup
PurchName
PurchaseType
PurchStatus
DocumentState
DeliveryDate

Then click Generate sample file.

7- when the excel file is opened, change the sheet name to POH.

8- Select the second sheet in the Excel, Change the sheet name to POL then add the following field names:

CurrencyCode
VendAccount
VendGroup
PurchId
ShippingDateConfirmed
LineNumber
ItemId
Name
PurchQty
PurchUnit
PurchPrice
InventSiteId
InventLocationId
PurchaseType

09- Go back to POH sheet, enter the purchase order header details.

10- select the POL sheet, Enter the purchase order lines details. in this example i will add two lines

10- when you finish make sure to save the file in the shared folder that we specified in step 2.

11- Go back to the processing group –> entities—> Select the “Purchase order header” entity, specify  the Excel file path then from the sheet lookup select POH$, click generate source mapping button.

12- Click New, Select Purchase order line entity, select Excel from source,specify the Excel file path then from the sheet lookup select POL$, click generate source mapping button then close.

13- To preview the Purchase header details select purchase order header entity then Click the Preview source file button.

14- To preview the Purchase lines details select purchase order line entity then Click the Preview source file button.

15- Close the form

16- In the processing group select the group name then click the Get staging data button to copy the file data to staging table.

17- Click OK to create job.

18- Click Run in the staging data execution form.

19- Click OK. (sorry, i forget to capture the screenshoot. its looks exactly like the following screenshot but with different name   )

20- The records will be inserted in the staging.

21- In the processing group select the group name then click Copy Data to target button.

22- Select the Job ID that we created in step 17 then click OK.

23- Click Run to import data.

24- Click OK.

25- The data will be written to target.

26- To view the imported purchase order go to the all purchase order list form, you will found that the purchase order was imported successfully.

 
Leave a comment

Posted by on September 10, 2015 in AX 2012, DIXF

 

Tags: ,

Passing a parameter value from ListPage:MenuItemButton control to a form in Ax 2012 list page


To pass a parameter value from ListPage:MenuItemButton control to a form in Ax 2012 list page below are the steps..

1. For the MenuItemButton control set the AutoDeclaration property “True”

2. In list page interaction class override the SelectionChanged() method. Add the code to pass parameter value as string. For example:

this.listPage().actionPaneControlParameters(formControlStr(ListPage Name,MenuItemButton Control Name),”Parameter Value”);

2. Now override the init() of the child form which is out put of MenuItemButton. Add the following code to retrieve the same..

info(element.args().parm());

 
Leave a comment

Posted by on July 1, 2015 in AX 2012, List Page

 

Tags: ,

“Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics”- error while import .xpo in ax 2012


The below error will come when you try to import and compare the objects from .XPO.

“Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics”

 
Solution: Full CIL will resolves the error.
If full CIL does not solves the issue then follow the below steps.
1. Stop the AOS.
2. Delete the *.pdb and *.netmodule files
3. Start AOS and do full CIL.
 
Leave a comment

Posted by on July 1, 2015 in AX 2012, CIL

 

Tags: ,

Announcing Cumulative Update 9 for Microsoft Dynamics AX 2012 R3


Cumulative update 9 (CU9)

Microsoft released the new cumulative update for Microsoft Dynamics AX 2012 R3, named Cumulative Update 9 (KB2998197). The version number of this release is 6.3.2000.326.

It has not been announced if there will be a release for other versions of Microsoft Dynamics AX 2012. An update installer is available on the “Update” tile in Lifecycle services.

Cumulative Update 9 build number is 6.3.2000.326. For installation instructions, download the Installation guide for cumulative update 9 for Microsoft Dynamics AX 2012 R3.

The newest changes can be found in the What’s new in Microsoft Dynamics AX 2012 document found here.

For detailed information on Microsoft Dynamics AX 2012 R3 CU9 release, please refer to the release notes official KB document KB3063879.

Please note, as happened for AX 2012 R3 CU8, the application version will show a different number of: 6.3.2000.323 if you apply CU9 to an existing install of Ax2012 R3.  This is due to all the granular models that are applied to your system through the CU9 install.  The one model indicating all models for CU9 has been applied has version number 6.3.2000.323.  Using a slipstream process as detailed in the Installation guide will result in the single full model applied for CU9 with build number 6.3.2000.326.

To learn about known issues in cumulative update 9, log into LCS by using CustomerSource or PartnerSource account. Then, in the Issue search box, enter “CU9 known issue” as the query for Microsoft Dynamics AX 2012 R3.

 
Leave a comment

Posted by on June 17, 2015 in AX 2012

 

Tags:

What are the differences between addOrderByField and addSortField


With addSortField you can set “only” the records order.

With AddOrderByField you can build some logic because is used the kernel class QueryOrderByField.

So, you can use the follow methods :
– direction
– autoHeader
– autoHeaderDetailLevel
– autoSum
– autoSumDetailLevel
– datasource
– fieldId

You can find some examples on the standard class :

– DimensionProvider Class, getDimensionOrderBysFromQuery method
– InventDimCtrl_Frm_OnHand class, modifyQuery method

 
Leave a comment

Posted by on June 12, 2015 in AX 2012, X++

 

Tags: ,

Cascade+Restricted Concept in Ax 2012Ax


Step 1:
Create 3 tables for an example :

Table 1- SheetTable, with Two fields Sheetid and sheetname
Table 2-PartitionTable with three fields sheetid , partitionid and sheetsize
Table 3-SheetPartitionTable with two fields partitionid and Shape 

Step 2:

1) Create a relationship between SheetTable and PartitionTable (Ex:PartitionTable.SheetID==SheetTable.SheetId) 

2) Create a relationship between PartitionTable and SheetPartitionTable(EX:SheetPartitionTable.PartitionID==PartitionTable.PartitionID)

Step 3:

1) Create Cascade DeleteAction between SheetTable and PartitionTable

2) Create Cascade+Restricted DeleteAction between PartitionTable and SheetPartitionTable

Step 4:
Open SheetTable and delete the matched record with PartitionTable.

Automatically the matched record from SheetTable , PartititonTable and SheetPartitionTable will be deleted .

 
Leave a comment

Posted by on June 10, 2015 in AX 2012, X++

 

Tags: ,

 
Dynamics Cognizance

Site presents solution to common and non-common Microsoft Dynamics Ax problems faced by Consultants and Administrators

365 by Thijs

Blogging about Microsoft 365, Azure and Automation!

axhowto

Blog about ax with sample codes, tips and tricks.

GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations

DynaD365Power

Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching

ErpCoder

Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX

“ANYONE WHO STOPS LEARNING IS OLD, WHETHER AT TWENTY OR EIGHTY.” —HENRY FORD

Sumit Potbhare

Dynamics 365 for Commerce

iotsolution.se

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens