返回秋毫ERP咨询论坛

- 微软ERP Dynamics AX,Nav,CRM,SL专业论坛,同时包括SAP,Oracle ERP讨论和相关文档下载。



返回本书目录


Previous Page
Next Page

Customizing an Existing XML Document

For an example of how to customize an XML document, assume that a new table containing several illustrations per inventory item is implemented in one of your customer-specific solutions. Now you want to include the illustrations with all purchase orders sent out as XML documents. The custom table layout for this example appears as shown in Figure 9-8.

Figure 9-8. Custom table layout.


The first step is to modify the query AxdPurchaseRequisition to also include the ItemIllustration table, the new table in the example custom solution. Figure 9-9 shows how the query looks when the new table is added. The boxed area must be added to the query that ships with Dynamics AX 4.0.

Figure 9-9. The query after adding the ItemIllustration table.


The second step in the process of customizing your XML document is to run the query through the Axd Wizard. The second page of the wizard prompts you for the query name on which you want to base your solution. In this example, the query name is AxdPurchaseRequisition. On the next page of the wizard, shown in Figure 9-10, you state the class name, which has the same value as the query name by default.

Figure 9-10. The wizard page on which you choose the actions that the XML document should support.


The remaining fields are indifferent to the processing, because no modifications will be made to existing Axd<Document> classes. If you carefully created the relationships in the query, the wizard can construct all required code in the prepareForSave method.

On the next page, select the first check box to generate new Ax<Table> classes. The second check box, which is optional, updates existing Ax<Table> classes, which will probably be current already.

After you complete the wizard, you must fix potential compilation errors and all the to-dos that the Axd Wizard produces. First, you remove the caching if it is not needed. You do this by removing the two methods called CacheObject and CacheRecordRecord. When removing these classes, you must also remove the two static variables from the class declarations cacheRecordIdx and cacheObjectIdx. Assume that InventDim is not influencing the Illustration; then you simply remove the optional parameter so that the parmItemId method looks like this.

public str parmItemId(str _itemId = '')
{
    DictField dictField;
    ;
    if (!prmisdefault(_itemId))
    {
        dictField = new DictField(tablenum
(ItemIllustration),fieldnum(ItemIllustration,
ItemId));
        this.validateInboundItemIdString(_itemId
,dictField);
        if(this.valueMappingInbound())
        {
            item = _itemId;
        }

        this.setField(fieldNum(ItemIllustration,
 ItemId), _itemId);
    }

    if (this.valueMappingOutbound())
    {
        return conpeek(this.axSalesItemId('',
 itemIllustration.ItemId),1);
    }
    else
    {
        return itemIllustration.ItemId;
    }
}


This concludes the implementation of the new table, and you can re-register the AxdPurchaseRequisition query from Basic\Setup\Application Integration Framework\Action to publish the new XML schema.


Previous Page
Next Page