Perfil de Santosh KumarSantosh Kumar Paruvella'...BlogListasLibro de visitasMás ![]() | Ayuda |
|
|
30 julio Dynamics Ax - AIF File system adapter Inbound common errorCommon Error: Cannot be read because the submitting user could not be determined. The default owner for objects created by members of the Administrators group must be set to the object creator. To avoid the above error do the following steps for file system adapters. Before you create the folder for the inbound file system adapter on the server, complete the following: 1. Click Start > Programs > Administrative Tools > Local Security Policy. 2. On the Local Security Settings menu, navigate to Security Settings > Local Policies > Security Options. 3. Change the Security Settings for the System Objects: Default owner for objects created by members of the administrator's group from Adminstrator's group to Object creator. 4. Log off and log back on to the computer. 5. Create the folder for the inbound file system transfer. 6. Verify that the owner of the folder is the user sending the document to Microsoft Dynamics AX (the submitting user) by: a. Right-clicking the folder and selecting Properties, and then b. Clicking Advanced on the Security tab to view the Advanced Security Settings.
After these settings are done place the XML file in that particular folder. Now run the AIF job to read the xml and to create the records in Dynamics – Ax.
Dynamics Ax - AIF Web Service for AxdSalesOrderHere I am going to give the sample application for consuming the AIF web Service in C#.Net.
For 1) AIF setup and Generation of the web service 2) how to take the reference of that service in VS application.
go through my previuos article.
http://paruvella.spaces.live.com/blog/cns!F2EC589E221A4DB0!114.entry
Then go through the following code for consume the AIF-SalesOrder web service using C# code in VS.Net.
namespace SalesOrderClient { class MySalesOrder { static void Main(string[] args) { CreateSalesOrder();
ReadSalesOrder();
}
static void CreateSalesOrder() { AxdSalesOrder so = new AxdSalesOrder(); AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable(); AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
salesTable.CustAccount = "4000"; salesTable.CurrencyCode = "USD"; salesTable.DeliveryDate = new DateTime(2008, 20, 7); salesTable.Payment = "M15";
salesLine.ItemId = "BR-14"; salesLine.SalesQty = 20; salesLine.SalesUnit = "Pcs";
salesTable.SalesLine = new AxdEntity_SalesLine[] { salesLine }; so.SalesTable = new AxdEntity_SalesTable[] { salesTable }; so.DocPurpose = AxdEnum_XMLDocPurpose.Original; so.DocPurposeSpecified = true;
// SalesOrderServiceContractClient is the proxy generated during the // reference of web service
SalesOrderServiceContractClient soService = new SalesOrderServiceContractClient();
// makes a call to Create action on the Axd
EntityKey ek = soService.createSalesOrder(so);
Console.WriteLine("Creates Sales Order Id : " + ek.KeyData[0].Value);
}
static void ReadSalesOrder() { EntityKey ek = new EntityKey();
KeyField kf = new KeyField(); kf.Field = "SalesId"; kf.Value = "00480_036";
ek.KeyData = new KeyField[] { kf };
SalesOrderServiceContractClient soService = new SalesOrderServiceContractClient();
// makes a call to read action on the Axd AxdSalesOrder so = soService.readSalesOrder(ek);
// Print the sales order read AxdEntity_SalesTable[] salesTables = so.SalesTable; foreach (AxdEntity_SalesTable salesTable in salesTables) { Console.WriteLine("Sales Order details :"); Console.WriteLine("--------------------");
string soName = salesTable.SalesName; string custAccount = salesTable.CustAccount; AxdEnum_SalesStatus salesStatus = salesTable.SalesStatus.GetValueOrDefault();
Console.WriteLine("Name : " + soName); Console.WriteLine("Customer Account : " + custAccount); Console.WriteLine("Status : " + salesStatus); Console.WriteLine("Purcase Order : " + salesTable.PurchOrderFormNum);
Console.WriteLine("Sales Line details :"); Console.WriteLine("--------------------");
AxdEntity_SalesLine[] salesLines = salesTable.SalesLine; foreach (AxdEntity_SalesLine salesLine in salesLines) { string itemId = salesLine.ItemId; string name = salesLine.Name; decimal qty = salesLine.QtyOrdered; decimal lineAmt = salesLine.LineAmount;
Console.WriteLine(" (1) "); Console.WriteLine("Item Id : " + itemId); Console.WriteLine("Name : " + name); Console.WriteLine("Qty : " + qty); Console.WriteLine("Line Amount : " + lineAmt); } }
} } } 25 julio Dynamics Ax - Update the records with single query statement.
For updating the ‘N’ no. of records we can use simple query statement instead of using while loop. (i.e. while select inventTrans where ) By using update_recordset we can update multiple records at a time.
oldRFQCaseId = this.orig().RFQCaseId;
ttsbegin;
update_recordset inventTrans setting TransRefId = this.RFQCaseId where inventTrans.TransRefId == oldRFQCaseId;
ttscommit;
18 julio Dynamics Ax - Use the Arithmetic Functions with query classesDynamics Ax - Using the Arithmetic functions with the query classes.
Query query;
QueryBuildDataSource queryBuildDataSource; query = new Query();
queryBuildDataSource = query.addDataSource(TableNum(AssetTrans)); queryBuildDataSource.orderMode(OrderMode::GROUPBY);
queryBuildDataSource.addSelectionField(FieldNum(AssetTrans,amountMST), SelectionField::SUM);
queryBuildDataSource.addSelectionField(FieldNum(AssetTrans,revaluationAmount), SelectionField::SUM);
queryBuildDataSource.addSortField(FieldNum(AssetTrans, transType));
queryBuildDataSource.addRange(FieldNum(AssetTrans,assetId)).value(rangeAssetId);
queryBuildDataSource.addRange(FieldNum(AssetTrans,bookId)).value(rangeBookId);
queryBuildDataSource.addRange(FieldNum(AssetTrans, transDate)).value(queryRange(dateFrom, dateTo));
return query;
Result of the above Query:
Another simple query using the query classes.
Query query = new Query();
QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; queryBuildDataSource = query.addDataSource(tablenum(PurchParmTable)); queryBuildRange = queryBuildDataSource.addRange(fieldNum(PurchParmTable, Ordering)); querybuildrange.value(queryvalue(documentstatus::PackingSlip));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(PurchParmTable, PurchId));
querybuildrange.value(queryvalue(purchparmtable.PurchId));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(PurchParmTable, ParmJobStatus));
querybuildrange.value(queryvalue('Executed')); queryBuildRange = queryBuildDataSource.addRange(fieldNum(PurchParmTable, Invoiced));
querybuildrange.value(queryvalue('No'));
this.query(query);
These are the simple examples using the query classes.
14 julio When is my Label file updated in AX?This is a good information about the label files.
enjoy... Dynamics Ax - Display the form with different colors for a particular control value
Displaying the form for different colors for salesId based on sales status.
Dynamics Ax - update using AIF to get the Document HashIn Dynamics Ax-2009 Document hash is mandatory to update the records using AIF. \Classes\AxdBaseUpdate\deserializeTopEntity in this method The mandatory condition has been implemented, so that the document hash which is present in the XML and matches the current version in the Db. This Document hash is calculated based on the RecId and Recversion of the record. Here is the sample application for to get the hash code for a particular record. class MyHashCodeTest extends AxdBaseRecordInfo { PurchRFQId rFQId; } public str getHashCode() { AxdBaseUpdate axdBaseUpdate =
AxdbaseUpdate::construct(); dataSourceMap =
new Map(Types::Integer,Types::Integer) ; _queryRun = new QueryRun(query);
topAxdBaseRecordInfo =
AxdBaseRecordInfo::buildStructuredDocument(_queryRun, dataSourceMap); return documentHash; } public void new(Common _common, int _dataSourceId) rFQId = 0; } void setRFQID(PurchRFQId _RFQId = '') ; } Job to get the Hash - Code for update (By using above class): static void Job1(Args _args)
MyHashCodeTest myHashCodeTest; select * from
purchRFQReplyTable where purchRFQReplyTable.RecId == 5637148795; _hashcode = myHashCodeTest.getHashCode(); print _hashcode; } Sample code to update the Document Hash in xml: xmlDocument = new
xmlDocument();
11 julio Dynamics Ax - AIF-Web Service Creating and Consuming AIF Web Services Pre-Setup · AOS, Client and BC.Net are installed · IIS is installed · ASP.NET 2.0 is enabled Setup · Install AIF Web Services (Use All Defaults) · Open the AX Client · Add a local end point Basic -> Setup -> Application Integration Framework -> Local endpoints Set Company as DAT and Local endpoint as localEndPoint · Add a web site Basic -> Setup -> Application Integration Framework -> Web sites Set the Name (Example: MicrosoftDynamicsAx) and Virtual directory share path to \\%MACHINENAME%\VirtualDirectory <file://%25machinename%25/VirtualDirectory> Name (Example: \\paruvella\MicrosoftDynamicsAXAif50 <file://paruvella/MicrosoftDynamicsAXAif50> ) · Generate the Service Basic -> Setup -> Application Integration Framework -> Services Select a service (Example: VendVendGroupService), click Enabled box, save and then click Generate button Now I have the service generated (Example: http://paruvella/MicrosoftDynamicsAXAif50/VendGroup.svc) Consuming the Service with example code · Create a client in VS (Example: a console app named TestClient) · Add the service reference previously created, Optional: enter a namespace name (Example: VendGroupService) · Add the reference to System.ServiceModel. This will generate the proxy for VendGroup service · Added the following code in the Program.cs file C# Code : namespace TestVendGroup { class TstFIMVendGrp_ReadVendGroup { static void Main(string[] args) { VendGroupServiceClient proxy = new VendGroupServiceClient(); AxdVendGroup vendGroup; EntityKey[] entityKeyList; EntityKey entityKey = new EntityKey(); KeyField keyField = new KeyField(); keyField.Field = "vendGroup"; keyField.Value = "DOM"; entityKey.KeyData = new KeyField[1] { keyField }; entityKeyList = new EntityKey[1] { entityKey }; vendGroup = proxy.read(entityKeyList); Console.Write(vendGroup.VendGroup[0].Name); Console.ReadLine(); } } } I started the writting blogs writting from today onwards. I will update my blog with more AIF related stuff. I am very much interest towards the AIF concepts. |
|
|