EConnect Basics
EConnect Basics
EConnect Basics
Incoming Integrations
Incoming integrations refer to any integration where data is moved into Microsoft
Dynamics GP. There are several ways to integrate data into Microsoft Dynamics
GP using eConnect:
Put an XML document on a queue and have the Incoming Service process
the document.
Send an XML document to BizTalk and have BizTalk process the document
by using the eConnect adapter.
An Incoming service is included with eConnect and can be used to pull documents
off a queue and push them directly into Microsoft Dynamics GP by using the
eConnect API. This means that all that you must do is create XML documents in
the correct format and then put them on a queue. The Incoming Service picks the
XML document off the queue, validates the document, and then creates the
appropriate record in Microsoft Dynamics GP.
Incoming Integrations (Part 2)
Assembly
Description
Microsoft.Dynamics.GP.eConnect.dll
Microsoft.Dynamics.GP.eConnect.MiscRout
ines.dll
Microsoft.Dynamics.GP.eConnect.Serializat
ion.dll
Add a Reference
In Visual Studio 2005, with the application open, click Project, and then click
Add Reference.
2.
Click the Browse tab and locate the assemblies. By default this location is:
C:\Program Files\Common Files\Microsoft Shared\eConnect 10\Objects\Dot Net
3.
Microsoft.Dynamics.GP.eConnect Assembly
Class
Description
eConnectMetho
ds
EnumTypes
eConnectExcepti
on
eConnectMethods Class
Method
Type
Description
eConnect_EntryPoint
Public
eConnect_Requester
Public
Type
Value
Description
None
No validation is performed.
XSD
ConnectionStringType enumeration
Type
Value
Description
SqlClien
t
OleDB
eConnect_EntryPoint method
//C#
eConnectResult = eConnectObject.eConnect_EntryPoint(ConnectionString,
EnumTypes.ConnectionStringType.SqlClient, xmlDoc.OuterXml,
EnumTypes.SchemaValidationType.None);
Parameter
Data Type
Description
ConnectionSt
ring
String
ConnectionTy
pe
Microsoft.Dynamics.GP.eConnect.EnumTypes.Connectio
nStringType
Use the
ConnectionStringT
ype enumeration
member that
specifies the data
server type.
ConnectionStringT
ype includes the
following
members:
SqlClient
OleDB
sXML
String
An eConnect XML
document.
ValidationTyp
e
Microsoft.Dynamics.GP.eConnect.EnumTypes.SchemaV
alidationTypes
Use a
SchemaValidation
Type enumeration
member to
specify the type
of data validation
to perform.
SchemaValidation
Type includes the
following
members:
None
XSD
eConnectSch
ema
string
Optional. If you
set the
ValidationType
parameter to use
XSD validation,
you must specify
the .xsd file that
contains the
schema
definition.
If Schema Validation is used and fails, an error similar to the image may be returned at
runtime.
//C#
//Create an XML Document object for the schema
XmlDocument XsdDoc = new XmlDocument();
//Default path to the eConnect.xsd file
//Change the filepath if the eConnect 10.0.0.0 SDK is installed in a location
//other than the default.
XsdDoc.Load(@"C:\Program Files\Common Files\Microsoft Shared\eConnect 10\XML Sample
Documents\Incoming XSD Schemas\eConnect.xsd");
string sXsdSchema;
//Create a string representing the eConnect schema
sXsdSchema = XsdDoc.OuterXml;
eConnectResult = eConnectObject.eConnect_EntryPoint(ConnectionString,
EnumTypes.ConnectionStringType.SqlClient, xmlDoc.OuterXml,
EnumTypes.SchemaValidationType.XSD, sXsdSchema);
eConnect_Requester Method
//C#
ReturnData_TextBox.Text=eConnectObject.eConnect_Requester(Co
nnectionString, EnumTypes.ConnectionStringType.SqlClient,
xmlDoc.OuterXml);
Parameter Data type
ConnectionStr String
ing
Description
Specifies the
data server and
databases.
ConnectionTy Microsoft.Dynamics.GP.eConnect.EnumTypes.ConnectionStrin Use the
pe
gType
ConnectionString
Type
enumeration
member that
specifies the
data server type.
ConnectionString
Type includes the
following
members:
sXml
String
SqlClient
OleDB
An eConnect XML
document.
eConnectException class
//C#
//If an eConnect error occurs, display the error message
catch (eConnectException eConnectError)
{
ReturnData_TextBox.Text = eConnectError.Message;
}
//If an unexpected error occurs, display the error message
catch (Exception ex)
{
ReturnData_TextBox.Text = ex.Message;
}
Microsoft.Dynamics.GP.eConnect.MiscRoutines Assembly
Class
Description
GetNextDocNumb
ers
Gets the next available number for several types of Microsoft Dynamics
GP documents.
GetSopNumber
Retrieves a SOP number for a sales document. This class also allows
you to return a SOP number that was retrieved but not used.
PricingMethods
//C#
private void btnCreate_Click(object sender, EventArgs e)
{
try
{
StringBuilder xml = new StringBuilder();
xml.Append("<eConnect>");
xml.Append("<PMVendorMasterType>");
xml.Append("<taUpdateCreateVendorRcd>");
xml.Append("<VENDORID>" + txtVendorID.Text.ToUpper() + "</VENDORID>");
xml.Append("<VENDNAME>" + txtVendorName.Text + "</VENDNAME>");
xml.Append("<VADDCDPR>" + txtAddressCode.Text + "</VADDCDPR>");
xml.Append("<VNDCNTCT>" + txtContact.Text + "</VNDCNTCT>");
xml.Append("<ADDRESS1>" + txtAddress1.Text + "</ADDRESS1>");
xml.Append("<CITY>" + txtCity.Text + "</CITY>");
xml.Append("<STATE>" + txtState.Text + "</STATE>");
xml.Append("<ZIPCODE>" + txtZip.Text + "</ZIPCODE>");
xml.Append("<PHNUMBR1>" + txtTelephoneNumber.Text + "</PHNUMBR1>");
xml.Append("</taUpdateCreateVendorRcd>");
xml.Append("</PMVendorMasterType>");
xml.Append("</eConnect>");
string connString ="Data Source=London; Initial Catalog=TWO; Integrated Security=SSPI;
Persist Security Info=False;";
eConnectMethods eConCall = new eConnectMethods();
bool status;
status = eConCall.eConnect_EntryPoint(connString,
EnumTypes.ConnectionStringType.SqlClient, xml.ToString(),
EnumTypes.SchemaValidationType.None, "");
if (status)
{
lblStatus.Text ="Document Successful";
lblStatus.Visible = true;
}
}
catch (eConnectException ex)
{
lblStatus.Text = ex.Message;
lblStatus.Visible = true;
}
}
When building integrations, you may need to include additional business logic to solve
a specific business problem. Within eConnect, there are several methods that you can
use to add the appropriate business logic. You can add an additional XML node to the
existing XML schema and use custom pre- and post stored procedures.
eConnect allows you to add XML nodes to its document schema. Custom XML nodes
enable you to use custom data elements within an eConnect XML document. Use
custom data elements to provide additional data or to trigger custom business logic.
When eConnect processes an XML document, it maps the name of each XML node to a
SQL stored procedure. The following XML creates a node named
<eConnectCustomProcedure>:
<eConnectCustomProcedure>
<CUSTNMBR>CONTOSOL0002</CUSTNMBR>
</eConnectCustomProcedure>
Use the eConnect XML document's <eConnectProcessInfo> node to control the stored
procedures' order of execution. To execute the eConnect core stored procedures prior
to any custom stored procedures, set the <eConnectProcsRunFirst> element to TRUE.
To execute custom stored procedures prior to the eConnect core stored procedures, set
<eConnectProcRunFirst> to FALSE.