Enable Emailing Prospect Quotes in GP

Hi All, this code below will enable prospect quotes to be emailed in GP by entering the correct records in the db. You just need to find the right trigger to call it before dexterity disables the email buttons. I use the following code to trigger it.

 

Private Sub SOPEntry_OpenAfterOriginal(sender As Object, e As EventArgs)
    AddHandler DynamicsGP.Functions.GatherSip.InvokeAfterOriginal, AddressOf GatherSip_AfterOriginal
End Sub
 then call my sub
Private Sub EnableEmail()
 
    Dim sopEntry As SopEntryForm = Microsoft.Dexterity.Applications.Dynamics.Forms.SopEntry
    Dim sopEntryWindow As SopEntryForm.SopEntryWindow = sopEntry.SopEntry
 
    If sopEntry.SopEntry.IsOpen = False Then Exit Sub
    If sopEntry.SopEntry.CustomerNumber.IsEmpty Then Exit Sub
 
    If sopEntry.SopEntry.SopType.Value = "1" Then
 
        'Variable for any table operation error
        Dim err As TableError
        'Create a reference to the table
        Dim EmailCardSetup As SyEmailCardSetupTable = Dynamics.Tables.SyEmailCardSetup
        Dim EmailCardDocTable As SyEmailCardDocumentsTable = Dynamics.Tables.SyEmailCardDocuments
        'Dim EmailDetailsTable As SyEmailDetailsTable = Dynamics.Tables.SyEmailDetails
        'Keys
        EmailCardDocTable.Key = 1
        EmailCardSetup.Key = 1
        'EmailDetailsTable.Key = 1
 
        'Set the key fields in the table
 
        'Read the data
 
        EmailCardDocTable.EmailSeriesId.Value = 3
        EmailCardDocTable.Module.Value = 11
        EmailCardDocTable.EmailCardId.Value = sopEntry.SopEntry.CustomerNumber.Value
        EmailCardDocTable.EmailDocumentId.Value = sopEntry.SopEntry.SopType.Value
 
 
        err = EmailCardDocTable.Change()
        'Update the data
        'If err = TableError.NoError Then
        'row was read succesfully so update the record
        EmailCardDocTable.EmailDocumentEnabled.Value = 1
        EmailCardDocTable.EmailDocumentFormat.Value = 3 '3 is PDF
 
        err = EmailCardDocTable.Save()
 
        If err <> TableError.NoError Then
            MsgBox("An error occurred updating the row: " + err.ToString)
        End If
 
        EmailCardDocTable.Close()
 
        'EmailDetailsTable.Close()
        sopEntry.SopEntry.EmailDetailsButton.Enable()
        sopEntry.SopEntry.EmailDocumentsButton.Enable()
        EmailObjForm.Functions.GetFileName.Invoke("")
    End If
 
End Sub

 

You can then add further functionality if you wish, I created a Reporting services report which can be emailed in the place of the standard GP word documents but I am still working on perfecting that.

 

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