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.
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)
3: new AifGatewayReceiveService().run();
4: new AifInboundProcessingService().run();
6: info('AIF processing done');
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.
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 Product candidate.Price delta <= 0.2
5. Select the type of automatic action (approve/reject)
Catalog import approval
This type of workflow is used for setting up the rules for approving the whole catalog. When you configure this workflow, you can reference the Catalog import product approval workflow that you configured earlier. The common setup would be to automatically approve the whole catalog import after all the products have been approved:
In the properties of the Vendor catalog lines (products) element you need to reference the catalog import product approval that you created earlier.
Enable a vendor for catalog import
In order to be able to import catalogs for a particular vendor it has to be enabled for catalog import. There are two ways to achieve that
– Click Procurement\Set up\Configure vendor for catalog import
– If you don’t do this you will be prompted if you want to enable the vendor for catalog import when creating a new catalog for the vendor
After you do this a subfolder in the catalog import root folder is created. The name of the folder is the RecId of the vendor.
Inside the folder you will find an archive folder with all the CMR files that have been imported for this vendor. You will also find a folder that is used for importing images of the vendor’s products.
Setup procurement hierarchy
You won’t be able to import products from categories where the vendor is not approved for procurement. To approve the vendor:
1. Go to Procurement and sourcing/Setup/Categories/Procurement categories.
2. Select the category.
Add the vendor to the list of approved vendors in the Vendors fast tab.
Importing a vendor catalog
Now that all the setup is done we are ready for creating a sample CMR file and importing it. We will write about it the next blog post.