RMSalespersonMasterType example

This piece of code will demonstrate how to code a salesperson insert using eConnect. We demonstrate with the RMSalespersonMasterType and taCreateSalesperson schemas.

 

Sub ImportSalesPerson(ByVal aLine As String())
    'get config info from the app.config file
    Dim strSqlServer As String = System.Configuration.ConfigurationManager.AppSettings("SqlServer")
    Dim strDatabase As String = System.Configuration.ConfigurationManager.AppSettings("Database")
    Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
    'this is our eConnectFunctions class, documented here: http://dyndeveloper.com/thread.aspx?Threadid=1117
    Dim oeConnectFunctions As New GP11.eConnectFunctions(strSqlServer, strDatabase)
    'instantiate our objects
    Dim oRMSalespersonMasterType As New Microsoft.Dynamics.GP.eConnect.Serialization.RMSalespersonMasterType
    Dim otaCreateSalesperson As New Microsoft.Dynamics.GP.eConnect.Serialization.taCreateSalesperson
    Dim bSuccess As Boolean = False
    Try
        'populate the object from the array passed in
        With otaCreateSalesperson
            .SLPRSNID = aLine(0)
            .SALSTERR = "TERRITORY 1"
        End With
        'send to the dynamics web service. 
        'the application will need a reference to the eConnect Web Service called 'Service1'
        oRMSalespersonMasterType.taCreateSalesperson = otaCreateSalesperson
        ReDim Preserve oeConnectType.RMSalespersonMasterType(0)
        oeConnectType.RMSalespersonMasterType(0) = oRMSalespersonMasterType
        'this is our eConnectFunctions class, documented here: http://dyndeveloper.com/thread.aspx?Threadid=1117
        bSuccess = oeConnectFunctions.CreateEntity(oeConnectType)
    Catch ex As Exception
        Throw ex
    End Try

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences