Источник:
http://blogs.msdn.com/b/dynamicsaxsc...t-1-setup.aspx
==============
We’ve been working on the import vendor catalogs functionality recently and realized that the ramp up time in this area is quite high. There is a lot of information on MSDN and on
InformationSource about the topic but there aren’t any documents which would guide you from the initial setup to creating and importing a sample catalog.
Creating and maintaining procurement catalogs that company employees can use when they order items or services for internal use is one of the major tasks in
Procurement and Sourcing. This can be done in several ways. Vendor catalog data can be added to the product master manually; the catalog can be
hosted externally or it can be
imported from a Catalog Maintenance Request (CMR) file. In this blog post I will focus on the last option: importing vendor catalogs. Before reading this blog post I recommend watching the “How to define procurement categories and catalogs – part 3” video on
InformationSource.
Vendor catalog import parameters
The first step will be to setup the Vendor catalog import parameters.
- Create a root folder where the CMR files will be stored (e.g. c:\temp\CMR).
- Click Procurement and sourcing > Setup > Vendors > Vendor catalog import parameters.
- In the Vendor catalog import parameters form, in the Root folder path field, enter the location of the root folder that you created for storing CMR files.
- The CatalogImportPickup folder is created automatically inside the folder you specified.
Setup AIF
After you set up the vendor catalog import parameters you will need to configure an inbound AIF integration port for catalog import. I will not go into details since the process is very well described in
this article.
There are a couple of additional steps which are not mentioned in the article:
1. When setting up the file adapter click the
Configure button, mark both checkboxes and specify the administrator user in the lookup. Not doing this will lead to an error during the import.
2. If you can’t see the
CatImpService.create in the service selection dialog you can go to the AOT, find the CatImpService under the Services node and click
Addins\Register service. The alternative is to go to
System administration > Setup > Checklists > Initialization checklist and click
Set up Application Integration Framework in the
Initialize system group.
You will also need some way of running the catalog import service. Normally this is done by setting up recurring batch jobs responsible for executing business logic through integration ports. To learn more about it read the
Configure and start the AIF batch services section of this MSDN
article.
This standard approach is intended for production. However it’s not very convenient for testing/learning purposes since the catalog import processing will be done asynchronously and the minimum recurrence interval is 1 minute. So I recommend using the x++ job below which performs the import catalog processing instantly:
1: static void runAIFReceive(Args _args) 2: { 3: new AifGatewayReceiveService().run(); 4: new AifInboundProcessingService().run(); 5: 6: info('AIF processing done'); 7: }
Setup workflow
The import vendor catalog functionality is leveraging another powerful feature of AX: workflow processing. You are allowed to setup rules for automated approval of vendor catalogs and specify one or more reviewers if manual approval is required. To enable the vendor catalog import functionality it is required to set up two types of workflows: Catalog import product approval (line-level), Catalog import approval (catalog-level).
Catalog import product approval
This type of workflow processes all the products that are included in the CMR file. Completion of all of the individual line-level workflow completes the overall catalog import workflow. In order to create a product approval workflow:
- Click Procurement and sourcing > Setup > Procurement and sourcing workflows.
- On the Action Pane, click New.
- Select Catalog import product approval and then click Create workflow.
General setup
The common catalog import product approval workflow should look like this:
Set up approvers
1. Double click the
Catalog import product approval element.
2. Click the
Step 1 element.
3. Click
Assignment in the action pane.
4. The simplest assignment would be User->Admin.
Set up automatic actions
Automatic actions allow the workflow framework to automatically approve or reject the products in the imported vendor catalog which meet certain conditions. In order to set up an automatic action you need to:
1. Select the
Catalog import product approval element.
2. Click
Automatic actions in the action pane.
3. Click the
Enable automatic actions check box
4. Setup the conditions for auto approval/rejection
There is one type of condition which I would like to focus on. You can specify
Product candidate.Price delta as a parameter of the automatic action. The price delta is calculated as a ratio: (new price – old price) / old price. So if you want to make sure that the price delta is within 20% you need to set the condition to <i>Product candidate.Price delta