DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In

Archives

 
This article provides a code example of how to use the Telerik RadGrid ItemDataBound event

If you're a consultant, entering reg keys in Dynamics is a simple thing, you do it daily (or so it seems)

Developers do it far less frequently, so this is a short guide on how to enter the registration keys in Dynamics GP

Why would a developer care about reg keys? Because you can't do any VBA or Modifier mods without a set of keys that allow it.

A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query

This code example is a short 'get started' piece of code designed to help with the syntax

This simple query is a starter for an AR report, it displays data by month (sales, payments, net) and adds a running total

The final output looks like this:

SQL SMO is a set of objects that can be used to manipulate SQL Server objects (servers, databases, tables… and so on) from.

Here is a piece of library code that will help you get started.

In order to use this class, you need the SMO object that get installed when you install the SQL SDK from the SQL setup.

Here is the code: I am getting the error when submitting the data. No Error coming when reading the data. This is small service upgrade from version 8 to 10.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient; 
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.EnterpriseServices;
using Microsoft.Dynamics.GP.eConnect;
using System.Xml;

namespace eConnect
{
	/// <summary>
	/// Web service for Great Plains integration via eConnect
	/// </summary>
	public class Poster : System.Web.Services.WebService
	{
        String ConnectionString;
        XmlDocument xmlDoc;

		public Poster()
		{
			//CODEGEN: This call is required by the ASP.NET Web Services Designer
			InitializeComponent();
		}

		#region Component Designer generated code
		
		//Required by the Web Services Designer 
		private IContainer components = null;
				
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if(disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);		
		}
		
		#endregion

		[ WebMethod(TransactionOption=TransactionOption.RequiresNew) ]
		public eConnectResult PostDoc(string xmldoc2)
		{
//            eConnectResult r = new eConnectResult("");
//            ContextUtil.DisableCommit();
//            ExecProcsXML.ExecStoredProcedure8Class test = new ExecProcsXML.ExecStoredProcedure8Class();
//            try 
//            {
//                r.result = test.ExecStoredProc(xmldoc,System.Configuration.ConfigurationSettings.AppSettings
[ "GPConnectionString"],ref r.errState,ref r.errString,ref r.soapMessage);
//                if (test.eConnectErrorState > 0)
//                {
//                    foreach (object o in test.ErrorCodes)
//                        r.errString += o.ToString();
//                    ContextUtil.SetAbort();
//                }
//                else
//                    ContextUtil.SetComplete();
//            }
//            catch
//            {
//                ContextUtil.SetAbort();
////				throw;
//            }
//          return r;
            xmlDoc.PreserveWhitespace = true;
            eConnectResult r = new eConnectResult("");
            ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["GPSqlConnectionString"];
            eConnectMethods eConnObject = new eConnectMethods();
            try
            {
                xmlDoc.LoadXml(xmldoc2);
                r.result = eConnObject.eConnect_EntryPoint(ConnectionString, 
EnumTypes.ConnectionStringType.OleDB, xmlDoc.OuterXml, EnumTypes.SchemaValidationType.None, null); ContextUtil.SetComplete(); } catch (eConnectException ex) { r.errString = ex.Message.ToString(); ContextUtil.SetAbort(); } catch (System.Data.SqlClient.SqlException ex) { foreach (object o in ex.Errors ) r.errString += o.ToString(); ContextUtil.SetAbort(); } catch (Exception ex) { r.errString = ex.Message.ToString(); ContextUtil.SetAbort(); } return r; } [WebMethod(TransactionOption = TransactionOption.RequiresNew)] public String PostDoc200(string xmldoc2) { bool eConnResult = false; String r; eConnectMethods eConnObject = new eConnectMethods(); try { r = ""; xmlDoc.LoadXml(xmldoc2); if (IsRequesterDoc(xmlDoc) == true) { r = eConnObject.eConnect_Requester(ConnectionString,
EnumTypes.ConnectionStringType.OleDB, xmlDoc.OuterXml); } else { eConnResult = eConnObject.eConnect_EntryPoint(ConnectionString,
EnumTypes.ConnectionStringType.OleDB, xmlDoc.OuterXml, EnumTypes.SchemaValidationType.None, null); if (eConnResult == true) { ContextUtil.SetComplete(); } else { ContextUtil.SetAbort(); } } } catch (eConnectException eConnErr) { r= eConnErr.Message; ContextUtil.SetAbort(); } catch (ApplicationException ex) { r= ex.Message; ContextUtil.SetAbort(); } return r; } [WebMethod] public DataSet ReadTable(string table,string columns,string condition) { DataSet s = new DataSet(); string sql = "select " + columns + " from " + table; if (condition != "") sql += " where " + condition; OleDbConnection con = new OleDbConnection(); //SqlDataAdapter.SqlConnection con = new SqlConnection(); con.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings
["GPSqlConnectionString"]; OleDbCommand cmd = new OleDbCommand(sql,con); //SqlCommand cmd = new SqlCommand(sql, con); con.Open(); OleDbDataAdapter ad = new OleDbDataAdapter(cmd); //SqlDataAdapter ad = new SqlDataAdapter(cmd); ad.Fill(s,table); cmd.Connection.Close(); return s; } public struct eConnectResult { public int errState; public string errString; public bool result; public string soapMessage; public eConnectResult(string s) { errState = 0; errString = ""; result = false; soapMessage = ""; } } private static bool IsRequesterDoc(XmlDocument doc) { //Create an XML node and query the document for the <Outgoing> node XmlNode RequesterMessage = default(XmlNode); RequesterMessage = doc.SelectSingleNode("//Outgoing"); //Return False if the <Outgoing> node is not found or its value is not equal to TRUE //Return True when the <Outgoing> node exists and it's value is equal to TRUE if (RequesterMessage == null) { return false; } else { if (RequesterMessage.InnerText == "TRUE") { return true; } else { return false; } } } } }

When I try to saved the item using econnect10. I am getting this error:. I have upgraded the web service code, as web aplication is not customizable so only whatever I have to do is ply through the econnect service. Provider two method READTable and POSTDOC.

Error sending XML Documnent into Great Plains:
Value cannot be null.
Parameter name: s

 



XML Document:
<?xml version="1.0" encoding="utf-8"?>
<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
    <SMItemMasterType>
        <taUpdateCreateItemRcd_Items>
            <taUpdateCreateItemRcd>
                <ITEMNMBR>FI111</ITEMNMBR>
                <ITEMDESC>185/70R14 Firestone F580 88 T B</ITEMDESC>
                <ITMSHNAM>185/70R14 Fires</ITMSHNAM>
                <Tolerance_Percentage>0</Tolerance_Percentage>
                <Revalue_Inventory>0</Revalue_Inventory>
                <LOCNCODE>STORE 11</LOCNCODE>
                <ITEMTYPE>1</ITEMTYPE>
                <CURRCOST>177.0000</CURRCOST>
                <UpdateIfExists>1</UpdateIfExists>
                <UOMSCHDL>EACH</UOMSCHDL>
                <PRCHSUOM>EACH</PRCHSUOM>
                <UseItemClass>1</UseItemClass>
                <ITMCLSCD>CONSIGN-H</ITMCLSCD>
                <Purchase_Tax_Options>2</Purchase_Tax_Options>
                <TAXOPTNS>2</TAXOPTNS>
                <ITMGEDSC>1857014</ITMGEDSC>
                <USCATVLS_1>Firestone</USCATVLS_1>
                <USCATVLS_2>F580</USCATVLS_2>
                <USCATVLS_3></USCATVLS_3>
            </taUpdateCreateItemRcd>
        </taUpdateCreateItemRcd_Items>
    </SMItemMasterType>
    <IVCreateItemPriceListType>
        <taIVCreateItemPriceListLine_Items>
            <taIVCreateItemPriceListLine>
                <ITEMNMBR>FI111</ITEMNMBR>
                <CURNCYID>SAR</CURNCYID>
                <PRCLEVEL>TIREWARE</PRCLEVEL>
                <UOFM>EACH</UOFM>
                <UOMPRICE>0</UOMPRICE>
                <UpdateIfExists>1</UpdateIfExists>
            </taIVCreateItemPriceListLine>
        </taIVCreateItemPriceListLine_Items>
        <taIVCreateItemPriceListHeader>
            <ITEMNMBR>FI111</ITEMNMBR>
            <PRICMTHD>1</PRICMTHD>
            <UOFM>EACH</UOFM>
            <PRCLEVEL>TIREWARE</PRCLEVEL>
            <CURNCYID>SAR</CURNCYID>
            <UpdateIfExists>1</UpdateIfExists>
        </taIVCreateItemPriceListHeader>
    </IVCreateItemPriceListType>
</eConnect>

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Error sending XML Documnent into Great Plains:
Value cannot be null.
Parameter name: s

XML Document:
<?xml version="1.0" encoding="utf-8"?>
<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
    <SMItemMasterType>
        <taUpdateCreateItemRcd_Items>
            <taUpdateCreateItemRcd>
                <ITEMNMBR>FI111</ITEMNMBR>
                <ITEMDESC>185/70R14 Firestone F580 88 T B</ITEMDESC>
                <ITMSHNAM>185/70R14 Fires</ITMSHNAM>
                <Tolerance_Percentage>0</Tolerance_Percentage>
                <Revalue_Inventory>0</Revalue_Inventory>
                <LOCNCODE>STORE 11</LOCNCODE>
                <ITEMTYPE>1</ITEMTYPE>
                <CURRCOST>177.0000</CURRCOST>
                <UpdateIfExists>1</UpdateIfExists>
                <UOMSCHDL>EACH</UOMSCHDL>
                <PRCHSUOM>EACH</PRCHSUOM>
                <UseItemClass>1</UseItemClass>
                <ITMCLSCD>CONSIGN-H</ITMCLSCD>
                <Purchase_Tax_Options>2</Purchase_Tax_Options>
                <TAXOPTNS>2</TAXOPTNS>
                <ITMGEDSC>1857014</ITMGEDSC>
                <USCATVLS_1>Firestone</USCATVLS_1>
                <USCATVLS_2>F580</USCATVLS_2>
                <USCATVLS_3></USCATVLS_3>
            </taUpdateCreateItemRcd>
        </taUpdateCreateItemRcd_Items>
    </SMItemMasterType>
    <IVCreateItemPriceListType>
        <taIVCreateItemPriceListLine_Items>
            <taIVCreateItemPriceListLine>
                <ITEMNMBR>FI111</ITEMNMBR>
                <CURNCYID>SAR</CURNCYID>
                <PRCLEVEL>TIREWARE</PRCLEVEL>
                <UOFM>EACH</UOFM>
                <UOMPRICE>0</UOMPRICE>
                <UpdateIfExists>1</UpdateIfExists>
            </taIVCreateItemPriceListLine>
        </taIVCreateItemPriceListLine_Items>
        <taIVCreateItemPriceListHeader>
            <ITEMNMBR>FI111</ITEMNMBR>
            <PRICMTHD>1</PRICMTHD>
            <UOFM>EACH</UOFM>
            <PRCLEVEL>TIREWARE</PRCLEVEL>
            <CURNCYID>SAR</CURNCYID>
            <UpdateIfExists>1</UpdateIfExists>
        </taIVCreateItemPriceListHeader>
    </IVCreateItemPriceListType>
</eConnect>

Source Error:

 

An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using the
exception stack trace below.

Stack Trace:

[Exception: Error sending XML Documnent into Great Plains:
Value cannot be null.
Parameter name: s

XML Document:
<?xml version="1.0" encoding="utf-8"?><eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
<SMItemMasterType><taUpdateCreateItemRcd_Items><taUpdateCreateItemRcd><ITEMNMBR>FI111</ITEMNMBR>
<ITEMDESC>185/70R14 Firestone F580 88 T B</ITEMDESC><ITMSHNAM>185/70R14 Fires</ITMSHNAM>
<Tolerance_Percentage>0</Tolerance_Percentage><Revalue_Inventory>0</Revalue_Inventory>
<LOCNCODE>STORE 11</LOCNCODE><ITEMTYPE>1</ITEMTYPE><CURRCOST>177.0000</CURRCOST>
<UpdateIfExists>1</UpdateIfExists><UOMSCHDL>EACH</UOMSCHDL><PRCHSUOM>EACH</PRCHSUOM>
<UseItemClass>1</UseItemClass><ITMCLSCD>CONSIGN-H</ITMCLSCD>
<Purchase_Tax_Options>2</Purchase_Tax_Options><TAXOPTNS>2</TAXOPTNS>
<ITMGEDSC>1857014</ITMGEDSC><USCATVLS_1>Firestone</USCATVLS_1>
<USCATVLS_2>F580</USCATVLS_2><USCATVLS_3></USCATVLS_3></taUpdateCreateItemRcd></taUpdateCreateItemRcd_Items>
</SMItemMasterType><IVCreateItemPriceListType><taIVCreateItemPriceListLine_Items>
<taIVCreateItemPriceListLine><ITEMNMBR>FI111</ITEMNMBR><CURNCYID>SAR</CURNCYID>
<PRCLEVEL>TIREWARE</PRCLEVEL><UOFM>EACH</UOFM><UOMPRICE>0</UOMPRICE>
<UpdateIfExists>1</UpdateIfExists></taIVCreateItemPriceListLine></taIVCreateItemPriceListLine_Items>
<taIVCreateItemPriceListHeader><ITEMNMBR>FI111</ITEMNMBR><PRICMTHD>1</PRICMTHD><UOFM>EACH</UOFM>
<PRCLEVEL>TIREWARE</PRCLEVEL><CURNCYID>SAR</CURNCYID>
<UpdateIfExists>1</UpdateIfExists></taIVCreateItemPriceListHeader></IVCreateItemPriceListType></eConnect>] tires.Components.GP.Adapter.SendDocument(String xmldoc) in C:\Repository\tires.Components
\GP\Adapter.cs:68 tires.Components.GP.GItem.syncItem(String itemId, String itemType, String path) in C:\Repository
\tires.Components\GP\GItem.cs:60 tires.Forms.inv.tiredata.SaveAllData(String itemID) in C:\Repository\tires\Forms\inv
\tiredata.aspx.cs:478 tires.Forms.inv.tiredatactrl.InventoryManagement() in C:\Repository\tires\Forms\inv
\tiredatactrl.ascx.cs:812 tires.Forms.inv.tiredatactrl.bSave_Click(Object sender, EventArgs e) in C:\Repository
\tires\Forms\inv\tiredatactrl.ascx.cs:881 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +1746

 

 

 

 

On a Win2K8 server, I'm getting an error message when trying to start eConnect:

The eConnect for Microsoft Dynamics GP2010 Integration Service service on <machine name> started and then stopped.

The error message is below.

Action:
Service Startup and Construction of Service Host

Current User Name:


Input parameters:

Exception type:
System.TypeInitializationException

Exception message:
The type initializer for 'System.ServiceModel.DiagnosticUtility' threw an exception.

Stack Trace:
at System.ServiceModel.ServiceHostBase..ctor()
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at Microsoft.Dynamics.GP.eConnect.WindowsService.CreateServiceHost()
Exception type:
System.Configuration.ConfigurationErrorsException

Exception message:
Configuration system failed to initialize

Stack Trace:
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
at System.Diagnostics.TraceSource.Initialize()
at System.Diagnostics.TraceSource.get_Listeners()
at System.ServiceModel.Diagnostics.DiagnosticTrace.UnsafeRemoveDefaultTraceListener(PiiTraceSource piiTraceSource)
at System.ServiceModel.Diagnostics.DiagnosticTrace.CreateTraceSource()
at System.ServiceModel.Diagnostics.DiagnosticTrace..ctor(TraceSourceKind sourceType, String traceSourceName, String eventSourceName)
at System.ServiceModel.DiagnosticUtility.InitDiagnosticTraceImpl(TraceSourceKind sourceType, String traceSourceName)
at System.ServiceModel.DiagnosticUtility.InitializeTracing()
at System.ServiceModel.DiagnosticUtility..cctor()
Exception type:
System.Configuration.ConfigurationErrorsException

Exception message:
Unrecognized configuration section system.diagnostics. (C:\Program Files (x86)\Microsoft Dynamics\eConnect 11.0\Service\Microsoft.Dynamics.GP.eConnect.Service.exe.Config line 3)

Stack Trace:
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

I'm getting 'A fatal error has been encountered. The Microsoft Dynamics GP installation has ended prematurely. Click Finish to exit the installation' when trying to install Dynamics GP9 onto Windows 7

When installing GP10 on a Win 2003 server, I get a red 'x' next to Microsoft Dexterity Shared Components 10.0.

Then: Initialization failed. Review the log file for more details: C:\DOCUME~1\<USERNAME>\LOCALS~1\Temp\1\log849.tmp

I drilled down in the CD to the Bin\DexCmn folder and ran the Dex Common files setup separately, and I got:

.Net Framework 2.0 is not installed. The installation cannot continue

Then: The Dexterity Shared Components installation has ended prematurely. Click Finish to exit the installation

It won't surprise you to learn that it is installed, in fact the 3.0 and 3.5 framework are also installed.

Your current SQL Server is not a supported version
Req: Microsoft SQL Server 8.0
Act: Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1
You need to upgrade to SQL Server 8.0 before continuing

When installing GP10 on a Win 2003 Server with SQL Server 2008 R2 installed.

 

I'm getting this error:

Unable to open module file 'C:\Users\<app name>\AppData\Local\Temp\3\.NETFramework,Version=v4.0.AssemblyAttributes.vb': The system cannot find the file specified.

When I run a certain application in Visual Studio 2010

 

The Visual Studio Templates feature requires Microsoft Visual Studio 2005, Service Pack 1 or later
The Visual Studio 2008 Templates feature requires Microsoft Visual Studio 2008

GP10 was originally designed for Visual Studio 2005, and then later Service Packed for 2008. But I'm doing a new install and trying to get it to work with VS 2010. By applying different service packs of VS Tools, I managed to get the above two errors.

This thread

http://dyndeveloper.com/thread.aspx?threadid=398

Is helping me greatly, but I'm not there yet, because this machine has only VS2010, I don't have 2008 to move the template files from

Sql procedure error codes returned:

Error Number = 8085
Stored Procedure= taUpdateCreateAccountRcd
Error Description = The Account Type is set to a Posting Account (ACCTTYPE = 1) and the Account Category (CATEGORY) passed does not exist in the GL Account Category Master table - GL00102
Node Identifier Parameters: taUpdateCreateAccountRcd
ACTNUMST = 0000
Related Error Code Parameters for Node : taUpdateCreateAccountRcd
ACCTTYPE = Note: This parameter was not passed in, no value for the parameter will be returned.
CATEGORY = FIXED ASSETS


<taUpdateCreateAccountRcd>
<ACTNUMST>0000</ACTNUMST>
<ACTDESCR>INVALID ACCOUNT</ACTDESCR>
<CATEGORY>FIXED ASSETS</CATEGORY>
</taUpdateCreateAccountRcd>