Источник:
http://axstart.spaces.live.com/Blog/...C0A0!359.entry
==============
Most of the time, when additional AX information is required in Microsoft CRM. It is information like:
- Invoice information
- Payment schedule information
- Delivery information of sales orders
Etc.
The look and feel of this information should be the responsibility of Dynamics CRM. Dynamics AX should provide the information. There are 2 ways Dynamics CRM can connect to Dynamics AX:
- AIF Web services
.Net Connector in combination with AIF base classes:
Personally I don’t think you need the Web services when Dynamics CRM and Dynamics AX are in the same domain. So install an AX dot Net client on the Dynamics CRM Server. The number of different used technologies is lower this way and that is always better to my opinion.
So how can we use the AIF base classes in c#?
I will use the base classes, In the next example. Additional the received XML file is converted to HTML with an XSL translation. This page can directly be shown in Dynamics CRM.
Example of using AIF base classes with x++.
In this example I call the framework twice, the first time the findEntityKeyList service, the second time the readList service. I only have to care about the correct ranges on my query object.
AIFDocumentXML aIFDocumentXML;
Query query = new Query(querystr(CustInvoiceJour));
AxdCustInvoiceJour axdCustInvoiceJour = axdBase::newClassId(classnum(AxdCustInvoiceJour));
AifQueryCriteria aifQueryCriteria = AifQueryCriteria::construct();
AifEndpointActionPolicyInfo aifEndpointActionPolicyInfo = new AifEndpointActionPolicyInfo();
;
aifQueryCriteria.parmQuery(query);
aIFDocumentXML = axdCustInvoiceJour.readList(
axdCustInvoiceJour.findEntityKeyList(aifQueryCriteria, aifEndpointActionPolicyInfo),
null,
AifEndpointActionPolicyInfo,
new AifConstraintListCollection(),
connull());
It is not possible to convert this code to c#, kernel functions like querystr and classnum do not exist in the .Net connector, but perhaps some other clever developer has an solution for this.
XSL translation from XML to HTML.
n1:CommissAmountMST
SKIP BIG PART OF XSLT
.
.
.
SKIP BIG PART OF XSLT
The HTM result. ( It is not spectacular, it just shows you, it will work J)
Light and Design
1234 Elm Street Los Angeles, CA 90011 US
00001_013
n1:CommissAmountMST
n1:CurrencyCode
n1:CustomerLineNum
n1:ItemId
n1:ItemName
n1:LineAmountMST
n1:LineAmountTaxMST
n1:LineNum
n1:Name
n1:Qty
n1:SalesId
n1:SalesUnit
n1:TaxAmountMST
USD
6000.00
1.0000000000
Sale of plant equipment
1.00
L.A. County School Purchase Association
567 Government Plaza Los Angeles, CA 90086 US
00001_043
00319_036
n1:CommissAmountMST
n1:CurrencyCode
n1:CustomerLineNum
n1:ItemId
n1:ItemName
n1:LineAmountMST
n1:LineAmountTaxMST
n1:LineNum
n1:Name
n1:Qty
n1:SalesId
n1:SalesUnit
n1:TaxAmountMST
-168.60
USD
CN-01
Chrome architect Lamp
-1440.00
Chrome architect Lamp
-3.00
00319_036
Pcs
So wrap up:
1. CRM connect to AX (.net client).
2. Call the AIF base framework.
3. AX response with XML file
4. convert is from XML to HTML with XSLT and MS CRM will show the page.

Источник:
http://axstart.spaces.live.com/Blog/...C0A0!359.entry