Get Before and after field change values with BPM

Kurt,

No problem. I've been helped out big time by the good folks on the forum before. Just pay it forward when you have the chance to answer someone else's question.

Cheers,
Jared

--- In vantage@yahoogroups.com, "Kurt" <iusevantage@...> wrote:
>
> Jared....thanks so much!! That was exactly what I needed and worked perfectly. I just needed to get used to the syntax a bit(it's a tad different than VB), but it ended up excellent!
>
> Thanks again very much for your help you really helped me out!!
>
> Regards,
>
> Kurt
Hi all,

Again I have something that I'm not even sure can be done. I have a user in purchasing that would like when a manufacturer or manufacturer (we use partrev character01 and character02 respectively) is changed, he wants the purchasing dept. to receive an email telling them that one of these fields has changed...but, he would like to have both the initial value and what the field was changed to.

I'm using the 'specified field has been changed from any to any' and this works fine, except I can only get what the new values are, not the previous. Is there a way to get the before and after values? I'm leaning toward that it's all said and done by the time the BPM is triggered, but if there is a way, that would be great.

Thanks for any help!!

Regards,

Kurt
Yes, this can be done.
While you're in the pre processing you have access to the tt tables which are the form data. You also have access to the actual table and it's data as well. So you generate an email using 4GL allowing you to have access to the original and changed values.
This can not be done if you use the BPM generate email template option, though.

________________________________

From: vantage@yahoogroups.com on behalf of Kurt
Sent: Wed 9/15/2010 10:54 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Get Before and after field change values with BPM




Hi all,

Again I have something that I'm not even sure can be done. I have a user in purchasing that would like when a manufacturer or manufacturer (we use partrev character01 and character02 respectively) is changed, he wants the purchasing dept. to receive an email telling them that one of these fields has changed...but, he would like to have both the initial value and what the field was changed to.

I'm using the 'specified field has been changed from any to any' and this works fine, except I can only get what the new values are, not the previous. Is there a way to get the before and after values? I'm leaning toward that it's all said and done by the time the BPM is triggered, but if there is a way, that would be great.

Thanks for any help!!

Regards,

Kurt






[Non-text portions of this message have been removed]
Update....
Sorry, it should read:
a manufacturer or manufacturer part number (we use partrev
character01 and character02 respectively)is changed

--- In vantage@yahoogroups.com, "Kurt" <iusevantage@...> wrote:
>
> Hi all,
>
> Again I have something that I'm not even sure can be done. I have a user in purchasing that would like when a manufacturer or manufacturer (we use partrev character01 and character02 respectively) is changed, he wants the purchasing dept. to receive an email telling them that one of these fields has changed...but, he would like to have both the initial value and what the field was changed to.
>
> I'm using the 'specified field has been changed from any to any' and this works fine, except I can only get what the new values are, not the previous. Is there a way to get the before and after values? I'm leaning toward that it's all said and done by the time the BPM is triggered, but if there is a way, that would be great.
>
> Thanks for any help!!
>
> Regards,
>
> Kurt
>
Sean,Thank you for your help!

I'll look in to this. I haven't done much with 4GL, I'm pretty much just using the standard BPM right now, but I'll see if I can find more on this. It sounds like 4GL would open a lot up for me.

Thanks again!! This does give me some guidance!

Regards,

Kurt

--- In vantage@yahoogroups.com, "Sean McDaniel" <smcdaniel@...> wrote:
>
> Yes, this can be done.
> While you're in the pre processing you have access to the tt tables which are the form data. You also have access to the actual table and it's data as well. So you generate an email using 4GL allowing you to have access to the original and changed values.
> This can not be done if you use the BPM generate email template option, though.
>
> ________________________________
>
> From: vantage@yahoogroups.com on behalf of Kurt
> Sent: Wed 9/15/2010 10:54 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Get Before and after field change values with BPM
>
>
>
>
> Hi all,
>
> Again I have something that I'm not even sure can be done. I have a user in purchasing that would like when a manufacturer or manufacturer (we use partrev character01 and character02 respectively) is changed, he wants the purchasing dept. to receive an email telling them that one of these fields has changed...but, he would like to have both the initial value and what the field was changed to.
>
> I'm using the 'specified field has been changed from any to any' and this works fine, except I can only get what the new values are, not the previous. Is there a way to get the before and after values? I'm leaning toward that it's all said and done by the time the BPM is triggered, but if there is a way, that would be great.
>
> Thanks for any help!!
>
> Regards,
>
> Kurt
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.

Thanks again!!

Regards,

Kurt

--- In vantage@yahoogroups.com, "Kurt" <iusevantage@...> wrote:
>
> Sean,Thank you for your help!
>
> I'll look in to this. I haven't done much with 4GL, I'm pretty much just using the standard BPM right now, but I'll see if I can find more on this. It sounds like 4GL would open a lot up for me.
>
> Thanks again!! This does give me some guidance!
>
> Regards,
>
> Kurt
>
> --- In vantage@yahoogroups.com, "Sean McDaniel" <smcdaniel@> wrote:
> >
> > Yes, this can be done.
> > While you're in the pre processing you have access to the tt tables which are the form data. You also have access to the actual table and it's data as well. So you generate an email using 4GL allowing you to have access to the original and changed values.
> > This can not be done if you use the BPM generate email template option, though.
> >
> > ________________________________
> >
> > From: vantage@yahoogroups.com on behalf of Kurt
> > Sent: Wed 9/15/2010 10:54 AM
> > To: vantage@yahoogroups.com
> > Subject: [Vantage] Get Before and after field change values with BPM
> >
> >
> >
> >
> > Hi all,
> >
> > Again I have something that I'm not even sure can be done. I have a user in purchasing that would like when a manufacturer or manufacturer (we use partrev character01 and character02 respectively) is changed, he wants the purchasing dept. to receive an email telling them that one of these fields has changed...but, he would like to have both the initial value and what the field was changed to.
> >
> > I'm using the 'specified field has been changed from any to any' and this works fine, except I can only get what the new values are, not the previous. Is there a way to get the before and after values? I'm leaning toward that it's all said and done by the time the BPM is triggered, but if there is a way, that would be great.
> >
> > Thanks for any help!!
> >
> > Regards,
> >
> > Kurt
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
Kurt,

Here's a 4GL email notification example I use when a part number on a quote line is changed. The Epicor framework includes the original row in the temp table to determine if the values have changed since they were downloaded to client, thus preventing corruption. The first FOR EACH looks for a blank RowMod which contains the original values. Use a pre-process directive and an action of execute 4GL code and paste in code similar to below. I didn't use a condition meaning it executes every time, but your mileage may vary. Make sure your install is configured for email notifications. Pretty straight forward but just post if you need help.

Cheers,
Jared

/*Create variable to hold stuff, i.e. old value and new value*/
DEF VAR msg AS CHARACTER NO-UNDO.
DEF VAR origPartNum AS CHARACTER NO-UNDO.
DEF VAR newPartNum AS CHARACTER NO-UNDO.
DEF VAR custName AS CHARACTER NO-UNDO.
DEF VAR quoteNum AS CHARACTER NO-UNDO.
DEF VAR quoteLine AS CHARACTER NO-UNDO.

/*Get original record with blank RowMod*/
FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='' no-lock:
origPartNum = ttQuoteDtl.PartNum.
quoteNum = STRING(ttQuoteDtl.QuoteNum).
quoteLine = STRING(ttQuoteDtl.QuoteLine).

/*next lines used for debugging*/
/*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
{lib/PublishInfoMsg.i &InfoMsg = msg }.
msg = "origPartNum:" + STRING(origPartNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }.*/
END.

/*now find changes*/
FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='U' no-lock:
FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND Customer.CustNum=ttQuoteDtl.CustNum.

/*if nothing changed the next code block is skipped*/
IF AVAIL Customer THEN
DO:
newPartNum = ttQuoteDtl.PartNum.
custName = Customer.Name.
/*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
{lib/PublishInfoMsg.i &InfoMsg = msg }.
msg = "newPartNum:" + STRING(newPartNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }.*/

/*This next IF is important. Maybe someone activated the field and hit a key which might trigger an Update event, but if the values are the same then don't send a notification*/
IF STRING(origPartNum) NE STRING(newPartNum) THEN
DO:
repeat:
/*create some email related variables*/
define variable vFrom as character no-undo initial '':U.
define variable vTo as character no-undo initial '':U.
define variable vCC as character no-undo initial '':U.
define variable vSubject as character no-undo initial '':U.
define variable vBody as character no-undo initial '':U.
define variable hEmailEx as handle no-undo.

run Bpm/BpmEmail.p persistent set hEmailEx.
/*I honestly can't remember why these integer cnt variables are in here.*/
define variable from_cnt as integer no-undo.
assign vFrom = 'sender@...'.

define variable to_cnt as integer no-undo.
assign vTo = 'recipient@...'.

define variable cc_cnt as integer no-undo.
assign vCC = ''.

define variable subject_cnt as integer no-undo.
assign vSubject = 'Notification: Part Number Change'.

define variable body_cnt as integer no-undo.
assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
+ "Customer: " + custName + CHR(10)
+ "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
+ "Original PartNum: " + origPartNum + CHR(10)
+ "New PartNum: " + newPartNum.

run SendEmail in hEmailEx (
false,
CUR-COMP,
vFrom,
vTo,
vCC,
vSubject,
vBody,
"":U
).
/*optional variables that can be included in the SendEmail call*/
/* async as logical
company as character
emailFrom as character
emailTo as character
emailCC as character
emailSubject as character
emailText as character
emailMimeHeader as character */

IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
leave.
END.
END.
END.
END.

--- In vantage@yahoogroups.com, "Kurt" <iusevantage@...> wrote:
>
> I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.
>
> Thanks again!!
>
> Regards,
>
> Kurt
Hi Jared,
I think you can accomplish the same thing doing something like this (assuming this is being done in pre-process) each cutting down on the complexity

for each ttQuoteDtl where ttQuoteDtl.RowMod='U',
each QuoteDtl where ttQuoteDtl.Company=QuoteDtl.Company and ttQuotedtl.Quotenum=QuoteDtl.QuoteNum and ttQuoteDtl.QuoteLine = QuoteDtl.QuoteLine
and ttQuoteDtl.PartNum <> QuoteDtl.PartNum. '//This is optional but shows you how to limit to changes of a specific field.

<Send Email Notification displaying previous values (QuoteDtl table) and new values (ttQuoteDtl table)>

End.

________________________________

From: vantage@yahoogroups.com on behalf of k99ja04
Sent: Wed 9/15/2010 3:48 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Get Before and after field change values with BPM




Kurt,

Here's a 4GL email notification example I use when a part number on a quote line is changed. The Epicor framework includes the original row in the temp table to determine if the values have changed since they were downloaded to client, thus preventing corruption. The first FOR EACH looks for a blank RowMod which contains the original values. Use a pre-process directive and an action of execute 4GL code and paste in code similar to below. I didn't use a condition meaning it executes every time, but your mileage may vary. Make sure your install is configured for email notifications. Pretty straight forward but just post if you need help.

Cheers,
Jared

/*Create variable to hold stuff, i.e. old value and new value*/
DEF VAR msg AS CHARACTER NO-UNDO.
DEF VAR origPartNum AS CHARACTER NO-UNDO.
DEF VAR newPartNum AS CHARACTER NO-UNDO.
DEF VAR custName AS CHARACTER NO-UNDO.
DEF VAR quoteNum AS CHARACTER NO-UNDO.
DEF VAR quoteLine AS CHARACTER NO-UNDO.

/*Get original record with blank RowMod*/
FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='' no-lock:
origPartNum = ttQuoteDtl.PartNum.
quoteNum = STRING(ttQuoteDtl.QuoteNum).
quoteLine = STRING(ttQuoteDtl.QuoteLine).

/*next lines used for debugging*/
/*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
{lib/PublishInfoMsg.i &InfoMsg = msg }.
msg = "origPartNum:" + STRING(origPartNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }.*/
END.

/*now find changes*/
FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='U' no-lock:
FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND Customer.CustNum=ttQuoteDtl.CustNum.

/*if nothing changed the next code block is skipped*/
IF AVAIL Customer THEN
DO:
newPartNum = ttQuoteDtl.PartNum.
custName = Customer.Name.
/*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
{lib/PublishInfoMsg.i &InfoMsg = msg }.
msg = "newPartNum:" + STRING(newPartNum).
{lib/PublishInfoMsg.i &InfoMsg = msg }.*/

/*This next IF is important. Maybe someone activated the field and hit a key which might trigger an Update event, but if the values are the same then don't send a notification*/
IF STRING(origPartNum) NE STRING(newPartNum) THEN
DO:
repeat:
/*create some email related variables*/
define variable vFrom as character no-undo initial '':U.
define variable vTo as character no-undo initial '':U.
define variable vCC as character no-undo initial '':U.
define variable vSubject as character no-undo initial '':U.
define variable vBody as character no-undo initial '':U.
define variable hEmailEx as handle no-undo.

run Bpm/BpmEmail.p persistent set hEmailEx.
/*I honestly can't remember why these integer cnt variables are in here.*/
define variable from_cnt as integer no-undo.
assign vFrom = 'sender@... <mailto:%27sender%40domain.com> '.

define variable to_cnt as integer no-undo.
assign vTo = 'recipient@... <mailto:%27recipient%40domain.com> '.

define variable cc_cnt as integer no-undo.
assign vCC = ''.

define variable subject_cnt as integer no-undo.
assign vSubject = 'Notification: Part Number Change'.

define variable body_cnt as integer no-undo.
assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
+ "Customer: " + custName + CHR(10)
+ "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
+ "Original PartNum: " + origPartNum + CHR(10)
+ "New PartNum: " + newPartNum.

run SendEmail in hEmailEx (
false,
CUR-COMP,
vFrom,
vTo,
vCC,
vSubject,
vBody,
"":U
).
/*optional variables that can be included in the SendEmail call*/
/* async as logical
company as character
emailFrom as character
emailTo as character
emailCC as character
emailSubject as character
emailText as character
emailMimeHeader as character */

IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
leave.
END.
END.
END.
END.

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> , "Kurt" <iusevantage@...> wrote:
>
> I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.
>
> Thanks again!!
>
> Regards,
>
> Kurt






[Non-text portions of this message have been removed]
Is there a downside to simply sending email using customization and VB vs a BPM like below?


Dim EmailMessage As String = "[message]"
Dim SmtpServer As New SmtpCLient()
Dim mail As New MailMessage()
SmtpServer.Port = 25
SmtpServer.Host = "[SERVER]"
mail = new MailMessage()
mail.From = New MailAddress("[Sender]")
mail.To.Add("[Receipient]")
Mail.Subject = [Subject]
Mail.Body = EmailMessage
SmtpServer.Send(mail)

--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Kurt,
>
> Here's a 4GL email notification example I use when a part number on a quote line is changed. The Epicor framework includes the original row in the temp table to determine if the values have changed since they were downloaded to client, thus preventing corruption. The first FOR EACH looks for a blank RowMod which contains the original values. Use a pre-process directive and an action of execute 4GL code and paste in code similar to below. I didn't use a condition meaning it executes every time, but your mileage may vary. Make sure your install is configured for email notifications. Pretty straight forward but just post if you need help.
>
> Cheers,
> Jared
>
> /*Create variable to hold stuff, i.e. old value and new value*/
> DEF VAR msg AS CHARACTER NO-UNDO.
> DEF VAR origPartNum AS CHARACTER NO-UNDO.
> DEF VAR newPartNum AS CHARACTER NO-UNDO.
> DEF VAR custName AS CHARACTER NO-UNDO.
> DEF VAR quoteNum AS CHARACTER NO-UNDO.
> DEF VAR quoteLine AS CHARACTER NO-UNDO.
>
> /*Get original record with blank RowMod*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='' no-lock:
> origPartNum = ttQuoteDtl.PartNum.
> quoteNum = STRING(ttQuoteDtl.QuoteNum).
> quoteLine = STRING(ttQuoteDtl.QuoteLine).
>
> /*next lines used for debugging*/
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "origPartNum:" + STRING(origPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
> END.
>
> /*now find changes*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='U' no-lock:
> FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND Customer.CustNum=ttQuoteDtl.CustNum.
>
> /*if nothing changed the next code block is skipped*/
> IF AVAIL Customer THEN
> DO:
> newPartNum = ttQuoteDtl.PartNum.
> custName = Customer.Name.
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "newPartNum:" + STRING(newPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
>
> /*This next IF is important. Maybe someone activated the field and hit a key which might trigger an Update event, but if the values are the same then don't send a notification*/
> IF STRING(origPartNum) NE STRING(newPartNum) THEN
> DO:
> repeat:
> /*create some email related variables*/
> define variable vFrom as character no-undo initial '':U.
> define variable vTo as character no-undo initial '':U.
> define variable vCC as character no-undo initial '':U.
> define variable vSubject as character no-undo initial '':U.
> define variable vBody as character no-undo initial '':U.
> define variable hEmailEx as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set hEmailEx.
> /*I honestly can't remember why these integer cnt variables are in here.*/
> define variable from_cnt as integer no-undo.
> assign vFrom = 'sender@...'.
>
> define variable to_cnt as integer no-undo.
> assign vTo = 'recipient@...'.
>
> define variable cc_cnt as integer no-undo.
> assign vCC = ''.
>
> define variable subject_cnt as integer no-undo.
> assign vSubject = 'Notification: Part Number Change'.
>
> define variable body_cnt as integer no-undo.
> assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
> + "Customer: " + custName + CHR(10)
> + "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
> + "Original PartNum: " + origPartNum + CHR(10)
> + "New PartNum: " + newPartNum.
>
> run SendEmail in hEmailEx (
> false,
> CUR-COMP,
> vFrom,
> vTo,
> vCC,
> vSubject,
> vBody,
> "":U
> ).
> /*optional variables that can be included in the SendEmail call*/
> /* async as logical
> company as character
> emailFrom as character
> emailTo as character
> emailCC as character
> emailSubject as character
> emailText as character
> emailMimeHeader as character */
>
> IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
> leave.
> END.
> END.
> END.
> END.
>
> --- In vantage@yahoogroups.com, "Kurt" <iusevantage@> wrote:
> >
> > I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.
> >
> > Thanks again!!
> >
> > Regards,
> >
> > Kurt
>
Sometimes the SMTP is only allowed messages from specific locations and
your customization would be sending the email from the client. If you
don't have security on your SMTP server then this wouldn't be a problem.

I try to start at the bottom with the easy things like a bpm, then move
up to customization, and so-forth until you reach SDK.

Ultimately with your customization you'd have to have it trigger on a
field change. However, if I change every field and then close the screen
without saving it, how many emails has it just sent?

Unless you hook it into when a save is done.



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of mmcwilliams22
Sent: Thursday, September 16, 2010 8:59 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Get Before and after field change values with BPM





Is there a downside to simply sending email using customization and VB
vs a BPM like below?

Dim EmailMessage As String = "[message]"
Dim SmtpServer As New SmtpCLient()
Dim mail As New MailMessage()
SmtpServer.Port = 25
SmtpServer.Host = "[SERVER]"
mail = new MailMessage()
mail.From = New MailAddress("[Sender]")
mail.To.Add("[Receipient]")
Mail.Subject = [Subject]
Mail.Body = EmailMessage
SmtpServer.Send(mail)

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"k99ja04" <jallmond@...> wrote:
>
> Kurt,
>
> Here's a 4GL email notification example I use when a part number on a
quote line is changed. The Epicor framework includes the original row in
the temp table to determine if the values have changed since they were
downloaded to client, thus preventing corruption. The first FOR EACH
looks for a blank RowMod which contains the original values. Use a
pre-process directive and an action of execute 4GL code and paste in
code similar to below. I didn't use a condition meaning it executes
every time, but your mileage may vary. Make sure your install is
configured for email notifications. Pretty straight forward but just
post if you need help.
>
> Cheers,
> Jared
>
> /*Create variable to hold stuff, i.e. old value and new value*/
> DEF VAR msg AS CHARACTER NO-UNDO.
> DEF VAR origPartNum AS CHARACTER NO-UNDO.
> DEF VAR newPartNum AS CHARACTER NO-UNDO.
> DEF VAR custName AS CHARACTER NO-UNDO.
> DEF VAR quoteNum AS CHARACTER NO-UNDO.
> DEF VAR quoteLine AS CHARACTER NO-UNDO.
>
> /*Get original record with blank RowMod*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND
ttQuoteDtl.RowMod='' no-lock:
> origPartNum = ttQuoteDtl.PartNum.
> quoteNum = STRING(ttQuoteDtl.QuoteNum).
> quoteLine = STRING(ttQuoteDtl.QuoteLine).
>
> /*next lines used for debugging*/
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "origPartNum:" + STRING(origPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
> END.
>
> /*now find changes*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND
ttQuoteDtl.RowMod='U' no-lock:
> FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND
Customer.CustNum=ttQuoteDtl.CustNum.
>
> /*if nothing changed the next code block is skipped*/
> IF AVAIL Customer THEN
> DO:
> newPartNum = ttQuoteDtl.PartNum.
> custName = Customer.Name.
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "newPartNum:" + STRING(newPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
>
> /*This next IF is important. Maybe someone activated the field and hit
a key which might trigger an Update event, but if the values are the
same then don't send a notification*/
> IF STRING(origPartNum) NE STRING(newPartNum) THEN
> DO:
> repeat:
> /*create some email related variables*/
> define variable vFrom as character no-undo initial '':U.
> define variable vTo as character no-undo initial '':U.
> define variable vCC as character no-undo initial '':U.
> define variable vSubject as character no-undo initial '':U.
> define variable vBody as character no-undo initial '':U.
> define variable hEmailEx as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set hEmailEx.
> /*I honestly can't remember why these integer cnt variables are in
here.*/
> define variable from_cnt as integer no-undo.
> assign vFrom = 'sender@...'.
>
> define variable to_cnt as integer no-undo.
> assign vTo = 'recipient@...'.
>
> define variable cc_cnt as integer no-undo.
> assign vCC = ''.
>
> define variable subject_cnt as integer no-undo.
> assign vSubject = 'Notification: Part Number Change'.
>
> define variable body_cnt as integer no-undo.
> assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
> + "Customer: " + custName + CHR(10)
> + "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
> + "Original PartNum: " + origPartNum + CHR(10)
> + "New PartNum: " + newPartNum.
>
> run SendEmail in hEmailEx (
> false,
> CUR-COMP,
> vFrom,
> vTo,
> vCC,
> vSubject,
> vBody,
> "":U
> ).
> /*optional variables that can be included in the SendEmail call*/
> /* async as logical
> company as character
> emailFrom as character
> emailTo as character
> emailCC as character
> emailSubject as character
> emailText as character
> emailMimeHeader as character */
>
> IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
> leave.
> END.
> END.
> END.
> END.
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"Kurt" <iusevantage@> wrote:
> >
> > I've been searching and I can't find any useful info on this.
Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example
how I'd send this email that you mentioned out....or somewhere that
would be a good guide? The 4GL in these PBM's are all new to me, but I'm
slowly making my way through. I have found examples on other things that
I have done, but this one I'm drawing blanks.
> >
> > Thanks again!!
> >
> > Regards,
> >
> > Kurt
>





[Non-text portions of this message have been removed]
Jared....thanks so much!! That was exactly what I needed and worked perfectly. I just needed to get used to the syntax a bit(it's a tad different than VB), but it ended up excellent!

Thanks again very much for your help you really helped me out!!

Regards,

Kurt

--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Kurt,
>
> Here's a 4GL email notification example I use when a part number on a quote line is changed. The Epicor framework includes the original row in the temp table to determine if the values have changed since they were downloaded to client, thus preventing corruption. The first FOR EACH looks for a blank RowMod which contains the original values. Use a pre-process directive and an action of execute 4GL code and paste in code similar to below. I didn't use a condition meaning it executes every time, but your mileage may vary. Make sure your install is configured for email notifications. Pretty straight forward but just post if you need help.
>
> Cheers,
> Jared
>
> /*Create variable to hold stuff, i.e. old value and new value*/
> DEF VAR msg AS CHARACTER NO-UNDO.
> DEF VAR origPartNum AS CHARACTER NO-UNDO.
> DEF VAR newPartNum AS CHARACTER NO-UNDO.
> DEF VAR custName AS CHARACTER NO-UNDO.
> DEF VAR quoteNum AS CHARACTER NO-UNDO.
> DEF VAR quoteLine AS CHARACTER NO-UNDO.
>
> /*Get original record with blank RowMod*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='' no-lock:
> origPartNum = ttQuoteDtl.PartNum.
> quoteNum = STRING(ttQuoteDtl.QuoteNum).
> quoteLine = STRING(ttQuoteDtl.QuoteLine).
>
> /*next lines used for debugging*/
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "origPartNum:" + STRING(origPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
> END.
>
> /*now find changes*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='U' no-lock:
> FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND Customer.CustNum=ttQuoteDtl.CustNum.
>
> /*if nothing changed the next code block is skipped*/
> IF AVAIL Customer THEN
> DO:
> newPartNum = ttQuoteDtl.PartNum.
> custName = Customer.Name.
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "newPartNum:" + STRING(newPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
>
> /*This next IF is important. Maybe someone activated the field and hit a key which might trigger an Update event, but if the values are the same then don't send a notification*/
> IF STRING(origPartNum) NE STRING(newPartNum) THEN
> DO:
> repeat:
> /*create some email related variables*/
> define variable vFrom as character no-undo initial '':U.
> define variable vTo as character no-undo initial '':U.
> define variable vCC as character no-undo initial '':U.
> define variable vSubject as character no-undo initial '':U.
> define variable vBody as character no-undo initial '':U.
> define variable hEmailEx as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set hEmailEx.
> /*I honestly can't remember why these integer cnt variables are in here.*/
> define variable from_cnt as integer no-undo.
> assign vFrom = 'sender@...'.
>
> define variable to_cnt as integer no-undo.
> assign vTo = 'recipient@...'.
>
> define variable cc_cnt as integer no-undo.
> assign vCC = ''.
>
> define variable subject_cnt as integer no-undo.
> assign vSubject = 'Notification: Part Number Change'.
>
> define variable body_cnt as integer no-undo.
> assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
> + "Customer: " + custName + CHR(10)
> + "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
> + "Original PartNum: " + origPartNum + CHR(10)
> + "New PartNum: " + newPartNum.
>
> run SendEmail in hEmailEx (
> false,
> CUR-COMP,
> vFrom,
> vTo,
> vCC,
> vSubject,
> vBody,
> "":U
> ).
> /*optional variables that can be included in the SendEmail call*/
> /* async as logical
> company as character
> emailFrom as character
> emailTo as character
> emailCC as character
> emailSubject as character
> emailText as character
> emailMimeHeader as character */
>
> IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
> leave.
> END.
> END.
> END.
> END.
>
> --- In vantage@yahoogroups.com, "Kurt" <iusevantage@> wrote:
> >
> > I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.
> >
> > Thanks again!!
> >
> > Regards,
> >
> > Kurt
>
Security on the SMTP is a concern, and as pointed out a VB customization will originate from client PC. I've done both approaches, and it seems like BPM emails are delivered faster. When I used the VB customization, it was because I needed to run a SQL query an external system. That functionality isn't available with a BPM. So your approach really depends on what you want to accomplish.
Jared

--- In vantage@yahoogroups.com, "Sean McDaniel" <smcdaniel@...> wrote:
>
> Sometimes the SMTP is only allowed messages from specific locations and
> your customization would be sending the email from the client. If you
> don't have security on your SMTP server then this wouldn't be a problem.
>
> I try to start at the bottom with the easy things like a bpm, then move
> up to customization, and so-forth until you reach SDK.
>
> Ultimately with your customization you'd have to have it trigger on a
> field change. However, if I change every field and then close the screen
> without saving it, how many emails has it just sent?
>
> Unless you hook it into when a save is done.
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of mmcwilliams22
> Sent: Thursday, September 16, 2010 8:59 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: Get Before and after field change values with BPM
>
>
>
>
>
> Is there a downside to simply sending email using customization and VB
> vs a BPM like below?
>
> Dim EmailMessage As String = "[message]"
> Dim SmtpServer As New SmtpCLient()
> Dim mail As New MailMessage()
> SmtpServer.Port = 25
> SmtpServer.Host = "[SERVER]"
> mail = new MailMessage()
> mail.From = New MailAddress("[Sender]")
> mail.To.Add("[Receipient]")
> Mail.Subject = [Subject]
> Mail.Body = EmailMessage
> SmtpServer.Send(mail)
Sean,

Seems like a valid approach to me. The only thing is, aren't you taking another round trip to the datasource by reading directly from the QuoteDtl table? By using the temp tables, we should already have the values in memory. I'm not 100% sure about the performance impact since BPMs execute on the server, but maybe someone more versed in the Epicor framework will chime in.

Suggestions and alternate approaches are always welcome!
Thanks,
Jared


--- In vantage@yahoogroups.com, "Sean McDaniel" <smcdaniel@...> wrote:
>
> Hi Jared,
> I think you can accomplish the same thing doing something like this (assuming this is being done in pre-process) each cutting down on the complexity
>
> for each ttQuoteDtl where ttQuoteDtl.RowMod='U',
> each QuoteDtl where ttQuoteDtl.Company=QuoteDtl.Company and ttQuotedtl.Quotenum=QuoteDtl.QuoteNum and ttQuoteDtl.QuoteLine = QuoteDtl.QuoteLine
> and ttQuoteDtl.PartNum <> QuoteDtl.PartNum. '//This is optional but shows you how to limit to changes of a specific field.
>
> <Send Email Notification displaying previous values (QuoteDtl table) and new values (ttQuoteDtl table)>
>
> End.
>
> ________________________________
>
> From: vantage@yahoogroups.com on behalf of k99ja04
> Sent: Wed 9/15/2010 3:48 PM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: Get Before and after field change values with BPM
>
>
>
>
> Kurt,
>
> Here's a 4GL email notification example I use when a part number on a quote line is changed. The Epicor framework includes the original row in the temp table to determine if the values have changed since they were downloaded to client, thus preventing corruption. The first FOR EACH looks for a blank RowMod which contains the original values. Use a pre-process directive and an action of execute 4GL code and paste in code similar to below. I didn't use a condition meaning it executes every time, but your mileage may vary. Make sure your install is configured for email notifications. Pretty straight forward but just post if you need help.
>
> Cheers,
> Jared
>
> /*Create variable to hold stuff, i.e. old value and new value*/
> DEF VAR msg AS CHARACTER NO-UNDO.
> DEF VAR origPartNum AS CHARACTER NO-UNDO.
> DEF VAR newPartNum AS CHARACTER NO-UNDO.
> DEF VAR custName AS CHARACTER NO-UNDO.
> DEF VAR quoteNum AS CHARACTER NO-UNDO.
> DEF VAR quoteLine AS CHARACTER NO-UNDO.
>
> /*Get original record with blank RowMod*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='' no-lock:
> origPartNum = ttQuoteDtl.PartNum.
> quoteNum = STRING(ttQuoteDtl.QuoteNum).
> quoteLine = STRING(ttQuoteDtl.QuoteLine).
>
> /*next lines used for debugging*/
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "origPartNum:" + STRING(origPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
> END.
>
> /*now find changes*/
> FOR EACH ttQuoteDtl WHERE ttQuoteDtl.Company=CUR-COMP AND ttQuoteDtl.RowMod='U' no-lock:
> FIND FIRST Customer WHERE Customer.Company=CUR-COMP AND Customer.CustNum=ttQuoteDtl.CustNum.
>
> /*if nothing changed the next code block is skipped*/
> IF AVAIL Customer THEN
> DO:
> newPartNum = ttQuoteDtl.PartNum.
> custName = Customer.Name.
> /*msg = "RowMod:" + STRING(ttQuoteDtl.RowMod).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.
> msg = "newPartNum:" + STRING(newPartNum).
> {lib/PublishInfoMsg.i &InfoMsg = msg }.*/
>
> /*This next IF is important. Maybe someone activated the field and hit a key which might trigger an Update event, but if the values are the same then don't send a notification*/
> IF STRING(origPartNum) NE STRING(newPartNum) THEN
> DO:
> repeat:
> /*create some email related variables*/
> define variable vFrom as character no-undo initial '':U.
> define variable vTo as character no-undo initial '':U.
> define variable vCC as character no-undo initial '':U.
> define variable vSubject as character no-undo initial '':U.
> define variable vBody as character no-undo initial '':U.
> define variable hEmailEx as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set hEmailEx.
> /*I honestly can't remember why these integer cnt variables are in here.*/
> define variable from_cnt as integer no-undo.
> assign vFrom = 'sender@... <mailto:%27sender%40domain.com> '.
>
> define variable to_cnt as integer no-undo.
> assign vTo = 'recipient@... <mailto:%27recipient%40domain.com> '.
>
> define variable cc_cnt as integer no-undo.
> assign vCC = ''.
>
> define variable subject_cnt as integer no-undo.
> assign vSubject = 'Notification: Part Number Change'.
>
> define variable body_cnt as integer no-undo.
> assign vBody = "A part number has been modified." + CHR(10) + CHR(10)
> + "Customer: " + custName + CHR(10)
> + "Quote Number: " + quoteNum + " Line: " + quoteLine + CHR(10)
> + "Original PartNum: " + origPartNum + CHR(10)
> + "New PartNum: " + newPartNum.
>
> run SendEmail in hEmailEx (
> false,
> CUR-COMP,
> vFrom,
> vTo,
> vCC,
> vSubject,
> vBody,
> "":U
> ).
> /*optional variables that can be included in the SendEmail call*/
> /* async as logical
> company as character
> emailFrom as character
> emailTo as character
> emailCC as character
> emailSubject as character
> emailText as character
> emailMimeHeader as character */
>
> IF valid-handle(hEmailEx) THEN delete procedure hEmailEx.
> leave.
> END.
> END.
> END.
> END.
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> , "Kurt" <iusevantage@> wrote:
> >
> > I've been searching and I can't find any useful info on this. Unfortunately, I'm not a 4GL'er (yet). Do you or anyone have an example how I'd send this email that you mentioned out....or somewhere that would be a good guide? The 4GL in these PBM's are all new to me, but I'm slowly making my way through. I have found examples on other things that I have done, but this one I'm drawing blanks.
> >
> > Thanks again!!
> >
> > Regards,
> >
> > Kurt
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>