Friday, April 06, 2007

Programming for Microsoft Dynamics (Navision)

Navision as we all know is very powerful with a very robust architecture.  The application allows you to add, edit, and design your own table and forms as well as reports.  The only problem is connecting to dynamics with your own application and retrieving data from it.  Western Computer an Oxnard, CA based company developed their admiral program named Fusion which breaks the barriers of connecting to Navision from within your .NET applications.  The company wrote a client they called the QueryLanguage to communicate with Fusion and push or pull data to Navision.  An example code snippet would look like so:

 

 public DataSet GetProfessionalAffiliations()

{

DataSet ds = null;

QueryGroup queryGroup = new QueryGroup(true);

Query query = queryGroup.NewQuery("ProAffiliation", "Professional Affiliation", WesternComputer.Fusion.QueryLanguage.CommandType.Select);

 

#region Set Columns

 

query.Columns.Add("Code");

query.Columns.Add("Description");

 

#endregion

 

// Execute query

ds = Globals.Gateway.ExecuteXmlToDataSet(queryGroup.ToXml());

 

// Check for Errors

string strMessage = "";

if (Globals.HasErrors(ds, out strMessage))

{

throw new Exception(strMessage);

}

 

return ds;

}


This simple query would go out to the FusionGateway (Web Service) and pull down the Professional Affiliation table records with the Code and Description Columns.  If any errors occurred in your query or on the Navision side a table is returned with TableName Query#Error.  This table will hold all errors that occurred so you can display them to the end user.  The best part, the error messages returned are the same error messages you are already accustomed to seeing in Navision.  They are Navision Error Messages.  The learning curve on this product is very low as it took myself 2 weeks to get my first application for Navision up and running on a Mobile Q device.  There are other features this provides such as StoredProcedure which will query a function written in Navision and return the result.  If you work with Navision then Fusion is a must have.

 

No comments:

 
Creative Commons License
Blogged Information and Code is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.