Showing posts with label AIF. Show all posts
Showing posts with label AIF. Show all posts

Tuesday, September 19, 2023

How to create a new custom financial dimension value with description and other parameters via X++

User can add values manually to Custom dimension attribute type only. For all other backing entities it should go via standard table creation, say, new CustTable record, etc.



The easiest way to create a new Custom list dimension value is to use the standard service DimensionValueService as follows. Say, you need to create a new value by using _newProjCategory record fields.

DimensionValueService dimensionValueService = new DimensionValueService();
DimensionValueContract dimensionValueContract = new DimensionValueContract();
dimensionValueContract.parmValue(_newProjCategory.Id);
dimensionValueContract.parmDimensionAttribute(myDimHelper::getProjCategoryAttribute);
dimensionValueContract.parmDescription(_newProjCategory.Name);

dimensionValueService.createDimensionValue(dimensionValueContract);

It creates the display value as its description.





 

Monday, April 10, 2017

AIF Many to One External Codes Value Mapping and Reverse View Extension

I do not see any reason why we are not allowed to map many external codes to one internal for AIF inbound port value mapping.

In fact, this is just a question of one additional table, which can be easily created as a copy of the exting one, and a slight change to three classes and AIF related forms.


For the demo's sake it is implemented for Customer and Units only, but you can add the same to any AX externally enabled table.

 Please download and use this extension to the standard AIF in AX 2012.

Another valuable feature of this project is the External codes Reverse View.


Any time I saw something like depicted, I dreamt to have a way to look into this halo in reverse.



The Reverse view enables you to find any existing relation between 1:1 and N:1 external and internal codes.

Filter by any column, export them to Excel, and go directly to the internal table by Edit or double-clicking.

Besides aforementioned, there are examples of using the powerfull AX objects, like:
- table map;
- Data Dictionary operations for scalability;
- set;
- InMemory and TempDB usage in Form and joins.


Thursday, March 17, 2016

How to add a new field to your AIF service

Let's say we have an AIF inbound port for importing Sales order requisition from a partner, and we need to add a new field to import Contact person.

In standard we can easily import Contact person by its ID. However, it is not probable that your partner uses the same internal IDs for contacts as you do.



On the other hand, there is no standard mapping feature for contact persons via external codes, like those we have for items, customers, vendors and some other artifacts.

So, our goal is to find a way to map an internal contact person ID to a given name. Something similar to what we do by selecting a contact from the drop-down list in Sales order, which is actually an Edit-method.



Basically we will touch two classes only.

First, we add a new parm method to SalesSalesOrder_SalesTable class, which exposes data through SalesSalesOrderService. In other words, this new parameter will be available in the fields of Data policy (document scheme). Also the exist method must be added to the same class.







Then we implement the logic in AxSalesTable class, which finds contact id based on the name provided in the aforementioned parameter.









We place the new method before standard setting Contact person id because the latter will use Contact person id, if it is already found.



Compile and compile incremental CIL.

Next step is to refresh service via Register menu.



We have paved the new way: AIF will search for Contact person based on an imported Person name.




Friday, November 30, 2012

Generating Sales order confirmation in XML file in AX 2012

Let's say we need to provide one of our vendors with a Sales order confirmation in the form of XML file for the further consuming in their automated system. We suppose your license configuration is OK for that.

First of all, the appropriate service has to be set up in AIF module of AX 2012. (For the previous version, take a look at Microsoft Dynamics AX AIF: Sending Outbound Documents Automatically post) Given that we are going to export this information, we need to create a new outbound port.

Setting new Outbound port

Open the form of Outbound ports (System administration/Setup/Services and Application Integration Framework) to set up one: give it a name and short description to recognize it later among others.

Adapter should be File system adapter to generate XML file.
URI is the path where you can find generated XML files. Of course, AX has to have appropriate rights for this folder.



Now, we are choosing in the drop-list the appropriate service defined in AOT. For the most documents these services are already created; however, if you need to set up some specific or even new document service, please refer to the development manual.

The one we are looking for is SalesSalesConfirmationService. As you can see, all the document services are named in a very evident style: you always know for which document it serves.



Do not worry, if you cannot find this service in the list because it exists but needs to be registered from AOT  like follows.

Open Services branch in AOT tree, find this service in it, and register by the context menu item. You need to do it every time you add a new document service. Now this service appears in the list.



Read method will be enough for our job, so we activate our new port. Now we can proceed with the next step:

Adding a batch job maintaining AIF module

For my particular case, I am adding two tasks within it:

 - AifOutboundProcessingService responsible for outbound processing; and
 - AifGatewaySendService that will save XML files in the folder of URI, defined on the preceding step.



Note that you have to strictly follow the sequence so that a document will be pushed in the Message queue first and then a file will be created.


Do not forget to start the batch job with the right recurrence rules. You find more detail on how to deal with this batch job here.

Print management for clients

Finally, we change the print management for the client to whom we want to send XML files while updating Sales order confirmation.



Choose Print archive as a Destination to avoid the real printing and to generate an XML file.


Since now, when I confirm a sales order for this client I get after within one-two minutes an appropriate XML file in the folder.



For your environment, of course, you need to use your own parameters like those for the file folder or period of time for the batch job.

Also, it is possible to set up Sales order confirmation as a batch job, too.

Let me know if you have any troubles with this!