Page 1 of 1

SO Custom Email

PostPosted: Fri Jul 10, 2015 6:07 pm
by 2can2
Hi, I am working on V70115 on Sql2008R2 and have modified the SO Custom Email Plugin. I have copied the section of code from 'Debtor Statement Emailing' where it gets the Email addresses of Contacts with Position 1,2,3 = 'Email Statements' - Lines 59 - 110. I had changed the check to be 'LIKE '2%Stat%' on the Statement plugin and it works great. I have modified this for the SO to be 'LIKE '2%Inv%'.
Having looked at the code I thought the Sql fetch would transfer to the SO Email without any changes. I inserted it before the email address is inserted -
emailReportDialog.EmailTo = debtor.EmailAddress 'salesOrderForm.SalesOrder.Debtor.Email
I have come up with an error though - it tells me that on Line 62 'Type : SqlDataReader is not defined'
I can't find any other reference to SqlDataReader in the 'Debtor Statement Emailing' so not sure what I need to do.
Could you please advise. XML attached.
Thanks

Re: SO Custom Email  Topic is solved

PostPosted: Wed Jul 15, 2015 7:31 pm
by Mike.Sheen
2can2 wrote:'Type : SqlDataReader is not defined'
I can't find any other reference to SqlDataReader in the 'Debtor Statement Emailing' so not sure what I need to do.


Hi Doug,

Add the following to the top of the plugin code:

Code: Select all
Imports System.Data.SqlClient


This imports the namespace System.Data.SqlClient into the assembly - SqlDataReader is actually System.Data.SqlClient.SqlDataReader - so you can refer to it as the fully namespaced name "System.Data.SqlClient.SqlDataReader", but that gets a bit tiring after a while so adding the "Imports System.Data.SqlClient" in the code before any class definitions will allow you to use simply "SqlDataReader" instead.

Mike

Re: SO Custom Email

PostPosted: Thu Jul 23, 2015 11:06 am
by 2can2
Thanks Mike. That helped greatly! I had a few more issue but eventually got it to work.

Cheers