Error "You cannot view data on this page because you are not a registered user in Microsoft Dynamics AX. Contact your Microsoft Dynamics AX administrator." while trying to browse EP from the AX Client".
Solution - To make sure EP website application pool account is same as the business connector proxy account under
System administration -> Setup -> System -> System service accounts
Friday, November 28, 2014
Tuesday, November 18, 2014
AX 2012 AIF - Inbound Test
1. Write a script and test the required fields of XML
VendInvoiceService vendInvoiceService = VendInvoiceService::construct();
AifQueryCriteria queryCriteria = AifQueryCriteria::construct();
VendInvoice VendInvoice = new VendInvoice();
XmlDocument xmlCreate;
AifCriteriaElement criteriaElement;
str xml = @'<?xml version="1.0" encoding="utf-8" ?>' +
@'<VendInvoice xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/VendInvoice">' +
@' <VendInvoiceInfoTable class="entity">' +
@' <PurchId>RA2-PO00000093</PurchId>' +
@' <RANInvoiceLocationURL>PUR</RANInvoiceLocationURL>' +
@' <RANInvoiceTotalInclTax>1500.01</RANInvoiceTotalInclTax>' +
@' <InclTax>yes</InclTax>' +
@' <CurrencyCode>AUD</CurrencyCode>' +
@' <DocumentDate>2014-11-12</DocumentDate>' +
@' <InvoiceAccount>3RDPA</InvoiceAccount>' +
@' <Num>201411120301</Num>' +
@' <PurchId>RA2-PO00000093</PurchId>' +
@' <VendInvoiceInfoSubTable class="entity">' +
@' <OrigPurchId>RA2-PO00000093</OrigPurchId>' +
@' <VendInvoiceInfoLine class="entity">' +
@' <Description>Tyler Describing stuff</Description>' +
@' <OrigPurchId>RA2-PO00000093</OrigPurchId>' +
@' <PurchaseLineLineNumber>1</PurchaseLineLineNumber>' +
@' <RANDocumentId>201411120401</RANDocumentId>' +
@' <ItemId>6310</ItemId>' +
@' <ReceiveNow>3</ReceiveNow>' +
@' </VendInvoiceInfoLine>' +
@' </VendInvoiceInfoSubTable>' +
@' </VendInvoiceInfoTable>' +
@' </VendInvoice>';
criteriaElement = AifCriteriaElement::newCriteriaElement(tablestr(VendInvoiceInfoTable),
fieldstr(VendInvoiceInfoTable, Num),
AifCriteriaOperator::NotEqual,
'0');
queryCriteria.addCriteriaElement(criteriaElement);
try
{
xmlCreate = XmlDocument::newXml(xml);
vendInvoice.deserialize(xmlCreate.xml());
vendInvoiceService.create(vendInvoice);
}
catch
{
exceptionTextFallThrough();
}
2. Configure the outbound port (field system adapter) with required fields
3. Create a class (extend AxSend) to generate the outboud record in the queue
AxdSendVendInvoice axdSendVendInvoice;
AifConstraintList aifConstraintList;
AifConstraint aifConstraint;
axdSendVendInvoice = new AxdSendVendInvoice();
aifConstraintList = new AifConstraintList();
aifConstraint = new AifConstraint();
aifConstraint.parmType(AifConstraintType::NoConstraint);
aifConstraintList.addConstraint(aifConstraint);
axdSendVendInvoice.parmShowDocPurpose(true);
axdSendVendInvoice.sendMultipleDocuments(classNum(VendInvoice), classNum(VendInvoiceService), AifSendMode::Async, aifConstraintList);
4. Run the script to generate the xml file to outbound folder
new AifOutboundProcessingService().run();
new AifGatewaySendService().run();
Note: The sequence of the fields in the xml is very important
<?xml version="1.0" encoding="utf-8" ?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{E120D4F9-C466-4CBF-BA60-E365202D7B19}</MessageId>
<Company>RA2</Company>
<Action>http://schemas.microsoft.com/dynamics/2008/01/services/VendVendInvoiceService/create</Action>
</Header>
<Body>
<MessageParts>
<VendInvoice xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/VendInvoice">
<VendInvoiceInfoTable class="entity">
<CurrencyCode>AUD</CurrencyCode>
<DocumentDate>2014-10-29</DocumentDate>
<InclTax>Yes</InclTax>
<InvoiceAccount>3RDPA</InvoiceAccount>
<Num>TGC1</Num>
<PurchId>RA2-PO00000093</PurchId>
<RANInvoiceLocationURL>PUR</RANInvoiceLocationURL>
<RANInvoiceTotalInclTax>1500.01</RANInvoiceTotalInclTax>
<VendInvoiceInfoSubTable class="entity">
<OrigPurchId>RA2-PO00000093</OrigPurchId>
<VendInvoiceInfoLine class="entity">
<Description>Tyler Describing stuff</Description>
<ItemId>6310</ItemId>
<OrigPurchId>RA2-PO00000093</OrigPurchId>
<PurchaseLineLineNumber>1</PurchaseLineLineNumber>
<PurchPrice>500</PurchPrice>
<PurchUnit>ea</PurchUnit>
<RANDocumentId>201411120401</RANDocumentId>
<ReceiveNow>3</ReceiveNow>
</VendInvoiceInfoLine>
</VendInvoiceInfoSubTable>
</VendInvoiceInfoTable>
</VendInvoice>
</MessageParts>
</Body>
</Envelope>
5. Configure the inbound port (Field system adapter) with required fields
6. Copy the xml files into inbound folder
Notes: The xml files would be deleted once the inbound service is run
7. Run the script to trigger the inbound services
new AifGatewayReceiveService().run();
new AifInboundProcessingService().run();
8. Check the records which should be created
VendInvoiceService vendInvoiceService = VendInvoiceService::construct();
AifQueryCriteria queryCriteria = AifQueryCriteria::construct();
VendInvoice VendInvoice = new VendInvoice();
XmlDocument xmlCreate;
AifCriteriaElement criteriaElement;
str xml = @'<?xml version="1.0" encoding="utf-8" ?>' +
@'<VendInvoice xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/VendInvoice">' +
@' <VendInvoiceInfoTable class="entity">' +
@' <PurchId>RA2-PO00000093</PurchId>' +
@' <RANInvoiceLocationURL>PUR</RANInvoiceLocationURL>' +
@' <RANInvoiceTotalInclTax>1500.01</RANInvoiceTotalInclTax>' +
@' <InclTax>yes</InclTax>' +
@' <CurrencyCode>AUD</CurrencyCode>' +
@' <DocumentDate>2014-11-12</DocumentDate>' +
@' <InvoiceAccount>3RDPA</InvoiceAccount>' +
@' <Num>201411120301</Num>' +
@' <PurchId>RA2-PO00000093</PurchId>' +
@' <VendInvoiceInfoSubTable class="entity">' +
@' <OrigPurchId>RA2-PO00000093</OrigPurchId>' +
@' <VendInvoiceInfoLine class="entity">' +
@' <Description>Tyler Describing stuff</Description>' +
@' <OrigPurchId>RA2-PO00000093</OrigPurchId>' +
@' <PurchaseLineLineNumber>1</PurchaseLineLineNumber>' +
@' <RANDocumentId>201411120401</RANDocumentId>' +
@' <ItemId>6310</ItemId>' +
@' <ReceiveNow>3</ReceiveNow>' +
@' </VendInvoiceInfoLine>' +
@' </VendInvoiceInfoSubTable>' +
@' </VendInvoiceInfoTable>' +
@' </VendInvoice>';
criteriaElement = AifCriteriaElement::newCriteriaElement(tablestr(VendInvoiceInfoTable),
fieldstr(VendInvoiceInfoTable, Num),
AifCriteriaOperator::NotEqual,
'0');
queryCriteria.addCriteriaElement(criteriaElement);
try
{
xmlCreate = XmlDocument::newXml(xml);
vendInvoice.deserialize(xmlCreate.xml());
vendInvoiceService.create(vendInvoice);
}
catch
{
exceptionTextFallThrough();
}
2. Configure the outbound port (field system adapter) with required fields
3. Create a class (extend AxSend) to generate the outboud record in the queue
AxdSendVendInvoice axdSendVendInvoice;
AifConstraintList aifConstraintList;
AifConstraint aifConstraint;
axdSendVendInvoice = new AxdSendVendInvoice();
aifConstraintList = new AifConstraintList();
aifConstraint = new AifConstraint();
aifConstraint.parmType(AifConstraintType::NoConstraint);
aifConstraintList.addConstraint(aifConstraint);
axdSendVendInvoice.parmShowDocPurpose(true);
axdSendVendInvoice.sendMultipleDocuments(classNum(VendInvoice), classNum(VendInvoiceService), AifSendMode::Async, aifConstraintList);
4. Run the script to generate the xml file to outbound folder
new AifOutboundProcessingService().run();
new AifGatewaySendService().run();
Note: The sequence of the fields in the xml is very important
<?xml version="1.0" encoding="utf-8" ?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{E120D4F9-C466-4CBF-BA60-E365202D7B19}</MessageId>
<Company>RA2</Company>
<Action>http://schemas.microsoft.com/dynamics/2008/01/services/VendVendInvoiceService/create</Action>
</Header>
<Body>
<MessageParts>
<VendInvoice xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/VendInvoice">
<VendInvoiceInfoTable class="entity">
<CurrencyCode>AUD</CurrencyCode>
<DocumentDate>2014-10-29</DocumentDate>
<InclTax>Yes</InclTax>
<InvoiceAccount>3RDPA</InvoiceAccount>
<Num>TGC1</Num>
<PurchId>RA2-PO00000093</PurchId>
<RANInvoiceLocationURL>PUR</RANInvoiceLocationURL>
<RANInvoiceTotalInclTax>1500.01</RANInvoiceTotalInclTax>
<VendInvoiceInfoSubTable class="entity">
<OrigPurchId>RA2-PO00000093</OrigPurchId>
<VendInvoiceInfoLine class="entity">
<Description>Tyler Describing stuff</Description>
<ItemId>6310</ItemId>
<OrigPurchId>RA2-PO00000093</OrigPurchId>
<PurchaseLineLineNumber>1</PurchaseLineLineNumber>
<PurchPrice>500</PurchPrice>
<PurchUnit>ea</PurchUnit>
<RANDocumentId>201411120401</RANDocumentId>
<ReceiveNow>3</ReceiveNow>
</VendInvoiceInfoLine>
</VendInvoiceInfoSubTable>
</VendInvoiceInfoTable>
</VendInvoice>
</MessageParts>
</Body>
</Envelope>
5. Configure the inbound port (Field system adapter) with required fields
6. Copy the xml files into inbound folder
Notes: The xml files would be deleted once the inbound service is run
7. Run the script to trigger the inbound services
new AifGatewayReceiveService().run();
new AifInboundProcessingService().run();
8. Check the records which should be created
Friday, November 7, 2014
AX 2012 DMF - Trigger the progress at the end of the DMF execution
If there is a process need to be trigger after the DMF execution, put the logic into postTargetProcess method of Entity class
And tick "Execute target step" to fire the postTargetProcess method
And tick "Execute target step" to fire the postTargetProcess method
Subscribe to:
Posts (Atom)