Proper PO Notifications

Here's what I wound up doing:

1. Save the below 4GL code API-POApprovalNotification.p as a .P file under mfgsys803\server\ud\ with whatever name you want.

2. Create a BAM on POHeader watching for changes in ApprovalStatus and ShortChar01. Add rules, For Alert, where ApprovalStatus <> U or ShortChar01 <> "".

3. Create a BPM as follows:
- POApvMsg.Update, Post-Processing
- Condition: Number of Rows in 'GetApvMsg' query is not lets than one
- Query: for each ttPOApvMsg where ttPOApvMsg.MsgType = '1' no-lock
- Action: Synchronously execute 4GL Action with code below, record nothing
- Code:

find ttPOApvMsg.
for each ttPOApvMsg no-lock:
message "ttPOApvMsg.PONum: " + string(ttPOApvMsg.PONum) + "~n".
find first POHeader where POHeader.Company = ttPOApvMsg.Company and POHeader.PONum = ttPOApvMsg.PONum no-lock.
define variable ApprovalChain as character no-undo.
ApprovalChain = POHeader.ShortChar01 + "/" + ttPOApvMsg.MsgTo.
run lib\UpdateTableBuffer.p(input BUFFER POHeader:HANDLE, 'ShortChar01',ApprovalChain).
end.

That's it.

The point here is that without the BPM you have no way that I could figure out how to detect when the up-level approval notification has been generated, so you'd only get an e-mail from the BAM from the initial PO approval request, not the subsequent ones. With the BPM I modify a ShortChar field in the POHeader table appending the next approver. The data is irrelevant, as long as the field changes, and thus the BAM gets triggered. This notification program sends e-mail to each approver in series (assuming their Buyer record has an e-mail address), and the requestor Buyer indicating the final disposition (approve or reject) of the PO approval request.

I needed to use a BAM because I didn't think one could use a BPM 4GL action to send e-mail. However I saw something about this come across the list recently (although I apparently didn't save it and given how badly the search works in this Yahoo! Group not sure if I can find it again), so I think you could do this entirely as a BPM if you wanted to keep it cleaner. It seems to me that one should be able to do everything in a BPM that one can do in a BAM.

-bws

-----Begin API-POApprovalNotification.p-----

{ud/GlbAlert.i &TableName = "POHeader"}

DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
DEFINE VARIABLE PONumber AS DECIMAL NO-UNDO.
DEFINE VARIABLE Company AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApprovalStatus AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApproverEmail AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApproverName AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApproverCode AS CHARACTER NO-UNDO.
DEFINE VARIABLE RequestorEmail AS CHARACTER NO-UNDO.
DEFINE VARIABLE RequestorName AS CHARACTER NO-UNDO.
DEFINE VARIABLE RequestorCode AS CHARACTER NO-UNDO.
DEFINE VARIABLE StatusText AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApprovalStatusDesc AS CHARACTER NO-UNDO.

PONumber = POHeader.PONum.
Company = POHeader.Company.
ApprovalStatus = POHeader.ApprovalStatus.

message "In API-POApprovalNotification.p: Company: " + Company + " PONumber: " + string(PONumber) + " ApprovalStatus: " + ApprovalStatus + "~r~n".

find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
for each PODetail of POHeader:
POAmount = POAmount + (PODetail.DocUnitCost * PODetail.OrderQty).
end.

find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum) no-lock no-error.

if available POApvMsg then do:

case POApvMsg.MsgType:
when "1" then do:
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
ApproverName = PurAgent.Name.
ApproverEmail = PurAgent.EmailAddress.
ApproverCode = PurAgent.BuyerID.
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerID = POApvMsg.MsgFrom) no-lock no-error.
RequestorName = PurAgent.Name.
RequestorEmail = PurAgent.EmailAddress.
RequestorCode = PurAgent.BuyerID.
end.
when "2" then do:
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
RequestorName = PurAgent.Name.
RequestorEmail = PurAgent.EmailAddress.
RequestorCode = PurAgent.BuyerID.
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerID = POApvMsg.MsgFrom) no-lock no-error.
ApproverName = PurAgent.Name.
ApproverEmail = PurAgent.EmailAddress.
ApproverCode = PurAgent.BuyerID.
end.
end case.


case ApprovalStatus:
when "A" then do:
StatusText = "Has Been Approved!".
ApprovalStatusDesc = "Approved".
Assign Email-To = RequestorEmail.
end.
when "R" then do:
StatusText = "Has Been Denied!".
ApprovalStatusDesc = "Rejected".
Assign Email-To = RequestorEmail.
end.
when "P" then do:
StatusText = "Requires Approval...".
ApprovalStatusDesc = "Pending Approval".
Assign Email-To = ApproverEmail.
Assign Email-CC = RequestorEmail.
end.
when "U" then do:
message "Not sending e-mail for ApprovalStatus = U".
Assign SendEmail = False.
end.
end case.

message "Email-To: " + Email-To + "~nEmail-CC: " + Email-CC.

/*
Assign Email-To = "bspolarich@...".
Assign Email-CC = "bspolarich@...".
*/

find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
Assign Email-From = "vantage-alerts@...".
Assign Email-Subject = POHeader.Company + " Purchase Order Approval Status Notification".
Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " " + StatusText + "~r~n"
+ "----------~r~n"
+ "Company: " + POHeader.Company + "~r~n"
+ "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~r~n"
+ "PO Amount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~r~n"
+ "Approval Status: " + ApprovalStatusDesc + "~r~n"
+ "Buyer: " + RequestorName + " (" + RequestorCode + ") <" + RequestorEmail + ">~r~n"
+ "PO Date: " + string(POHeader.OrderDate) + "~r~n"
+ "Approver: " + ApproverName + " (" + ApproverCode + ") <" + ApproverEmail + ">~r~n"
+ "Comments: ~r~n" + POHeader.CommentText + "~r~n".

if (POApvMsg.MsgText <> "") then do:
Assign Email-Text = Email-Text + "Approval Message Log: ~r~n" + POApvMsg.MsgText + "~r~n".
end.
message "Email-Text: ~n" + Email-Text.
end.
else do:
message "Not sending e-mail.~r~n".
Assign SendEmail = False.
return "Cancel Send".
end.
-----End API-POApprovalNotification.p-----

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of dashkarl
Sent: Monday, August 31, 2009 1:51 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Proper PO Notifications

Brian:
Does the BAM you use to send this request to the appropriate individual rely on a .p file to strip out the name for the Email_to? If so, could you share what this looks like.

Thanks,
-Karl
Is it possible to send e-mail from a 4GL BPM action?



I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.



Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.



Seems straightforward except for the invocation of the e-mail piece.



Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.



-bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>





[Non-text portions of this message have been removed]
Brian, I am not quite sure about the BPM email from a 4GL action,
however this example might be what you are after with regards to a BAM



FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
(PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.

In the body of the code:
/* Lines of Order */
FOR EACH PODetail of POHeader no-lock:
FIND PORel WHERE (PORel.Company = PODetail.Company) AND
(PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
NO-LOCK NO-ERROR.

FOR EACH PORel of PODetail no-lock:
Assign NewEmailBody = NewEmailBody
+ " Item " + STRING(PODetail.POLine) + ": "
+ STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
+ " - Due: " + STRING(PORel.DueDate)
+ " - Qty: " + STRING(PODetail.OrderQty)
+ " - Price: " + STRING(PODetail.UnitCost)
+ "~n".
END.
END.



And another simple example..



Below is one I use for emailing when a job is ready for receipt to
stock...



{ud/GlbAlert.i & TableName = "JobHead"}

Assign Email-Text = "The following is ready for receipt to stock;" +
"~tJob Number: " + string(JobHead.JobNum)

+ "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)

+ "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 11:04 AM
To: vantage@yahoogroups.com
Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?





Is it possible to send e-mail from a 4GL BPM action?

I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.

Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.

Seems straightforward except for the invocation of the e-mail piece.

Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich@...
<mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Hi,

I have been trying to execute an email from the 4GL in the BPM but got no where.... Loads of errors...

Just thinking about it, a very little bit.

Have a bpm that is triggered on the below that updates a checkbox field in the PO header. The Bam runs off of this, looks up to poaprvmsg table and then sends an email , and then unticks the checkbox. Never done this, is this possible?



--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Is it possible to send e-mail from a 4GL BPM action?
>
>
>
> I'm refining my PO Approval notification process and I want the
> notification to go to the person who actually has to *approve* the PO
> (shocking idea). I looked in the list archives and didn't see anyone
> actually doing the obvious here.
>
>
>
> Basically I want to look at PO.ChangeApproveSwitch, and if the
> POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
> and POApvMsg to PurAgent to get the e-mail address of the intended
> approver, and send that person an e-mail.
>
>
>
> Seems straightforward except for the invocation of the e-mail piece.
>
>
>
> Alternatively I could do this as a BAM. Does anyone have an example I
> could draw from that shows how to do a query in a BAM to find a
> recordset and use the data in that recordset? I've done it in a BPM but
> not a BAM and I'm not sure if there's different scaffolding required to
> set it up.
>
>
>
> -bws
>
>
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> Picometrix
>
> bspolarich@...
> <mailto:bspolarich@...> ~ 734-864-5618 ~
> www.advancedphotonix.com <http://www.advancedphotonix.com>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
This is a great start Rob.

I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)

The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.

-bws

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
Sent: Tuesday, July 14, 2009 12:17 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?

Brian, I am not quite sure about the BPM email from a 4GL action,
however this example might be what you are after with regards to a BAM



FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
(PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.

In the body of the code:
/* Lines of Order */
FOR EACH PODetail of POHeader no-lock:
FIND PORel WHERE (PORel.Company = PODetail.Company) AND
(PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
NO-LOCK NO-ERROR.

FOR EACH PORel of PODetail no-lock:
Assign NewEmailBody = NewEmailBody
+ " Item " + STRING(PODetail.POLine) + ": "
+ STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
+ " - Due: " + STRING(PORel.DueDate)
+ " - Qty: " + STRING(PODetail.OrderQty)
+ " - Price: " + STRING(PODetail.UnitCost)
+ "~n".
END.
END.



And another simple example..



Below is one I use for emailing when a job is ready for receipt to
stock...



{ud/GlbAlert.i & TableName = "JobHead"}

Assign Email-Text = "The following is ready for receipt to stock;" +
"~tJob Number: " + string(JobHead.JobNum)

+ "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)

+ "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 11:04 AM
To: vantage@yahoogroups.com
Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?





Is it possible to send e-mail from a 4GL BPM action?

I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.

Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.

Seems straightforward except for the invocation of the e-mail piece.

Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich@...
<mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
Ill send you the file offline..its a .p file that you put in your Epicor
server file path ill send you screen shots of where that goes too... you
can use notepad to write it and just give it a name with a .p
extension..



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 1:22 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?





This is a great start Rob.

I'm not 100% sure how to interpret this though. I suspect I'm being
dense. :-)

The first part "FIND PODetail WHERE ..." -- where does this go? Is this
part of the *.i file? 'Cause then you say "In the body of the code:"
which is clearly not part of the 4GL code.

-bws

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix
bspolarich@...
<mailto:bspolarich%40advancedphotonix.com> ~ 734-864-5618 ~
www.advancedphotonix.com

-----Original Message-----
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of Rob Bucek
Sent: Tuesday, July 14, 2009 12:17 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?

Brian, I am not quite sure about the BPM email from a 4GL action,
however this example might be what you are after with regards to a BAM

FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
(PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.

In the body of the code:
/* Lines of Order */
FOR EACH PODetail of POHeader no-lock:
FIND PORel WHERE (PORel.Company = PODetail.Company) AND
(PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
NO-LOCK NO-ERROR.

FOR EACH PORel of PODetail no-lock:
Assign NewEmailBody = NewEmailBody
+ " Item " + STRING(PODetail.POLine) + ": "
+ STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
+ " - Due: " + STRING(PORel.DueDate)
+ " - Qty: " + STRING(PODetail.OrderQty)
+ " - Price: " + STRING(PODetail.UnitCost)
+ "~n".
END.
END.

And another simple example..

Below is one I use for emailing when a job is ready for receipt to
stock...

{ud/GlbAlert.i & TableName = "JobHead"}

Assign Email-Text = "The following is ready for receipt to stock;" +
"~tJob Number: " + string(JobHead.JobNum)

+ "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)

+ "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 11:04 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?

Is it possible to send e-mail from a 4GL BPM action?

I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.

Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.

Seems straightforward except for the invocation of the e-mail piece.

Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
<http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links





[Non-text portions of this message have been removed]
I have done something very similiar to this. On a Sales Order I have a button that puts a check in a user defined checkbox. This checkbox fires a BAM that sends an email. In the BAM code for the email, it puts a check in another User Defined box on the Sales Order to indicate that an email has been sent so that it doesn't get sent again by mistake. It is kind of a convoluted process, but works fine for us.




________________________________
From: brychanwilliams <brychanwilliams@...>
To: vantage@yahoogroups.com
Sent: Tuesday, July 14, 2009 12:29:20 PM
Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?





Hi,

I have been trying to execute an email from the 4GL in the BPM but got no where.... Loads of errors...

Just thinking about it, a very little bit.

Have a bpm that is triggered on the below that updates a checkbox field in the PO header. The Bam runs off of this, looks up to poaprvmsg table and then sends an email , and then unticks the checkbox. Never done this, is this possible?

--- In vantage@yahoogroups .com, "Brian W. Spolarich " <bspolarich@ ...> wrote:
>
> Is it possible to send e-mail from a 4GL BPM action?
>
>
>
> I'm refining my PO Approval notification process and I want the
> notification to go to the person who actually has to *approve* the PO
> (shocking idea). I looked in the list archives and didn't see anyone
> actually doing the obvious here.
>
>
>
> Basically I want to look at PO.ChangeApproveSwi tch, and if the
> POHeader.ApprovalSt atus = 'P' then I want to join POHeader to POApvMsg
> and POApvMsg to PurAgent to get the e-mail address of the intended
> approver, and send that person an e-mail.
>
>
>
> Seems straightforward except for the invocation of the e-mail piece.
>
>
>
> Alternatively I could do this as a BAM. Does anyone have an example I
> could draw from that shows how to do a query in a BAM to find a
> recordset and use the data in that recordset? I've done it in a BPM but
> not a BAM and I'm not sure if there's different scaffolding required to
> set it up.
>
>
>
> -bws
>
>
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> Picometrix
>
> bspolarich@. ..
> <mailto:bspolarich@ ...> ~ 734-864-5618 ~
> www.advancedphotoni x.com <http://www.advanced photonix. com>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>







[Non-text portions of this message have been removed]
Check box fired BAM's rock!



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Steven Gotschall
Sent: Tuesday, July 14, 2009 2:11 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?





I have done something very similiar to this. On a Sales Order I have a
button that puts a check in a user defined checkbox. This checkbox
fires a BAM that sends an email. In the BAM code for the email, it puts
a check in another User Defined box on the Sales Order to indicate that
an email has been sent so that it doesn't get sent again by mistake. It
is kind of a convoluted process, but works fine for us.

________________________________
From: brychanwilliams <brychanwilliams@...
<mailto:brychanwilliams%40yahoo.com> >
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Sent: Tuesday, July 14, 2009 12:29:20 PM
Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?

Hi,

I have been trying to execute an email from the 4GL in the BPM but got
no where.... Loads of errors...

Just thinking about it, a very little bit.

Have a bpm that is triggered on the below that updates a checkbox field
in the PO header. The Bam runs off of this, looks up to poaprvmsg table
and then sends an email , and then unticks the checkbox. Never done
this, is this possible?

--- In vantage@yahoogroups .com, "Brian W. Spolarich " <bspolarich@ ...>
wrote:
>
> Is it possible to send e-mail from a 4GL BPM action?
>
>
>
> I'm refining my PO Approval notification process and I want the
> notification to go to the person who actually has to *approve* the PO
> (shocking idea). I looked in the list archives and didn't see anyone
> actually doing the obvious here.
>
>
>
> Basically I want to look at PO.ChangeApproveSwi tch, and if the
> POHeader.ApprovalSt atus = 'P' then I want to join POHeader to
POApvMsg
> and POApvMsg to PurAgent to get the e-mail address of the intended
> approver, and send that person an e-mail.
>
>
>
> Seems straightforward except for the invocation of the e-mail piece.
>
>
>
> Alternatively I could do this as a BAM. Does anyone have an example I
> could draw from that shows how to do a query in a BAM to find a
> recordset and use the data in that recordset? I've done it in a BPM
but
> not a BAM and I'm not sure if there's different scaffolding required
to
> set it up.
>
>
>
> -bws
>
>
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix
/
> Picometrix
>
> bspolarich@. ..
> <mailto:bspolarich@ ...> ~ 734-864-5618 ~
> www.advancedphotoni x.com <http://www.advanced photonix. com>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Id like to shake this out..where is the PO.CHangeApproveSwitch you
mentioned located?



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 11:04 AM
To: vantage@yahoogroups.com
Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?





Is it possible to send e-mail from a 4GL BPM action?

I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.

Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.

Seems straightforward except for the invocation of the e-mail piece.

Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich@...
<mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
Here's what I wound up with. It's a custom Alert action that gets triggered off of an update to POHeader.POApprovalStatus, filtered by POApprovalStatus = "P" (pending).

This will send an e-mail to the approver notifying them that the Purchase Order awaits their approval.

Thanks to Rob Bucek for his helpful prodding which got me going in the right direction!

Here's the code:

{ud/GlbAlert.i &TableName = "POHeader"}

DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.

message "PONum: " + string(POHeader.PONum).

find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
for each PODetail of POHeader:
POAmount = POAmount + (PODetail.DocUnitCost + PODetail.OrderQty).
end.

find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
and POApvMsg.MsgType = "1" no-lock no-error.

if available POApvMsg then do:
message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
if available PurAgent then do:
find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
if available Vendor then do:
message "Approver E-Mail: " + PurAgent.EmailAddress.
message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
Assign Email-From = "vantage-alerts@...".
Assign Email-To = PurAgent.EmailAddress.
Assign Email-Subject = POHeader.Company + " Purchase Order Approval Notification".
Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " requires approval.~n"
+ "----------~n"
+ "Company: " + POHeader.Company + "~n"
+ "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
+ "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
+ "Buyer: " + POHeader.BuyerID + "~n"
+ "PODate: " + string(POHeader.OrderDate) + "~n"
+ "Comments: ~n" + POHeader.CommentText + "~n".
end.
end.
end.

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 2:22 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?

This is a great start Rob.

I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)

The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.

-bws

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
Sent: Tuesday, July 14, 2009 12:17 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?

Brian, I am not quite sure about the BPM email from a 4GL action,
however this example might be what you are after with regards to a BAM



FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
(PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.

In the body of the code:
/* Lines of Order */
FOR EACH PODetail of POHeader no-lock:
FIND PORel WHERE (PORel.Company = PODetail.Company) AND
(PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
NO-LOCK NO-ERROR.

FOR EACH PORel of PODetail no-lock:
Assign NewEmailBody = NewEmailBody
+ " Item " + STRING(PODetail.POLine) + ": "
+ STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
+ " - Due: " + STRING(PORel.DueDate)
+ " - Qty: " + STRING(PODetail.OrderQty)
+ " - Price: " + STRING(PODetail.UnitCost)
+ "~n".
END.
END.



And another simple example..



Below is one I use for emailing when a job is ready for receipt to
stock...



{ud/GlbAlert.i & TableName = "JobHead"}

Assign Email-Text = "The following is ready for receipt to stock;" +
"~tJob Number: " + string(JobHead.JobNum)

+ "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)

+ "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Tuesday, July 14, 2009 11:04 AM
To: vantage@yahoogroups.com
Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?





Is it possible to send e-mail from a 4GL BPM action?

I'm refining my PO Approval notification process and I want the
notification to go to the person who actually has to *approve* the PO
(shocking idea). I looked in the list archives and didn't see anyone
actually doing the obvious here.

Basically I want to look at PO.ChangeApproveSwitch, and if the
POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
and POApvMsg to PurAgent to get the e-mail address of the intended
approver, and send that person an e-mail.

Seems straightforward except for the invocation of the e-mail piece.

Alternatively I could do this as a BAM. Does anyone have an example I
could draw from that shows how to do a query in a BAM to find a
recordset and use the data in that recordset? I've done it in a BPM but
not a BAM and I'm not sure if there's different scaffolding required to
set it up.

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich%40advancedphotonix.com>
<mailto:bspolarich@...
<mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links





------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
Hi,

Could I ask a quick question, would this work when you have more than one tier of approvals. We have three tiers, does the field get changed to hit the trigger , even if it is just rewriting P
Thanks

--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Here's what I wound up with. It's a custom Alert action that gets triggered off of an update to POHeader.POApprovalStatus, filtered by POApprovalStatus = "P" (pending).
>
> This will send an e-mail to the approver notifying them that the Purchase Order awaits their approval.
>
> Thanks to Rob Bucek for his helpful prodding which got me going in the right direction!
>
> Here's the code:
>
> {ud/GlbAlert.i &TableName = "POHeader"}
>
> DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
>
> message "PONum: " + string(POHeader.PONum).
>
> find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
> for each PODetail of POHeader:
> POAmount = POAmount + (PODetail.DocUnitCost + PODetail.OrderQty).
> end.
>
> find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
> and POApvMsg.MsgType = "1" no-lock no-error.
>
> if available POApvMsg then do:
> message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
> find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
> if available PurAgent then do:
> find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
> if available Vendor then do:
> message "Approver E-Mail: " + PurAgent.EmailAddress.
> message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
> Assign Email-From = "vantage-alerts@...".
> Assign Email-To = PurAgent.EmailAddress.
> Assign Email-Subject = POHeader.Company + " Purchase Order Approval Notification".
> Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " requires approval.~n"
> + "----------~n"
> + "Company: " + POHeader.Company + "~n"
> + "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
> + "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
> + "Buyer: " + POHeader.BuyerID + "~n"
> + "PODate: " + string(POHeader.OrderDate) + "~n"
> + "Comments: ~n" + POHeader.CommentText + "~n".
> end.
> end.
> end.
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Brian W. Spolarich
> Sent: Tuesday, July 14, 2009 2:22 PM
> To: vantage@yahoogroups.com
> Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
> This is a great start Rob.
>
> I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)
>
> The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.
>
> -bws
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
> Sent: Tuesday, July 14, 2009 12:17 PM
> To: vantage@yahoogroups.com
> Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
> Brian, I am not quite sure about the BPM email from a 4GL action,
> however this example might be what you are after with regards to a BAM
>
>
>
> FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
> (PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.
>
> In the body of the code:
> /* Lines of Order */
> FOR EACH PODetail of POHeader no-lock:
> FIND PORel WHERE (PORel.Company = PODetail.Company) AND
> (PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
> NO-LOCK NO-ERROR.
>
> FOR EACH PORel of PODetail no-lock:
> Assign NewEmailBody = NewEmailBody
> + " Item " + STRING(PODetail.POLine) + ": "
> + STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
> + " - Due: " + STRING(PORel.DueDate)
> + " - Qty: " + STRING(PODetail.OrderQty)
> + " - Price: " + STRING(PODetail.UnitCost)
> + "~n".
> END.
> END.
>
>
>
> And another simple example..
>
>
>
> Below is one I use for emailing when a job is ready for receipt to
> stock...
>
>
>
> {ud/GlbAlert.i & TableName = "JobHead"}
>
> Assign Email-Text = "The following is ready for receipt to stock;" +
> "~tJob Number: " + string(JobHead.JobNum)
>
> + "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)
>
> + "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of Brian W. Spolarich
> Sent: Tuesday, July 14, 2009 11:04 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
>
>
>
>
> Is it possible to send e-mail from a 4GL BPM action?
>
> I'm refining my PO Approval notification process and I want the
> notification to go to the person who actually has to *approve* the PO
> (shocking idea). I looked in the list archives and didn't see anyone
> actually doing the obvious here.
>
> Basically I want to look at PO.ChangeApproveSwitch, and if the
> POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
> and POApvMsg to PurAgent to get the e-mail address of the intended
> approver, and send that person an e-mail.
>
> Seems straightforward except for the invocation of the e-mail piece.
>
> Alternatively I could do this as a BAM. Does anyone have an example I
> could draw from that shows how to do a query in a BAM to find a
> recordset and use the data in that recordset? I've done it in a BPM but
> not a BAM and I'm not sure if there's different scaffolding required to
> set it up.
>
> -bws
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> Picometrix
>
> bspolarich@...
> <mailto:bspolarich%40advancedphotonix.com>
> <mailto:bspolarich@...
> <mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
> www.advancedphotonix.com <http://www.advancedphotonix.com>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>
>
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>
Hi,

Is there anychance you could share the code for the BAM?

Thanks

--- In vantage@yahoogroups.com, Steven Gotschall <sgotschall@...> wrote:
>
> I have done something very similiar to this. On a Sales Order I have a button that puts a check in a user defined checkbox. This checkbox fires a BAM that sends an email. In the BAM code for the email, it puts a check in another User Defined box on the Sales Order to indicate that an email has been sent so that it doesn't get sent again by mistake. It is kind of a convoluted process, but works fine for us.
>
>
>
>
> ________________________________
> From: brychanwilliams <brychanwilliams@...>
> To: vantage@yahoogroups.com
> Sent: Tuesday, July 14, 2009 12:29:20 PM
> Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?
>
>
>
>
>
> Hi,
>
> I have been trying to execute an email from the 4GL in the BPM but got no where.... Loads of errors...
>
> Just thinking about it, a very little bit.
>
> Have a bpm that is triggered on the below that updates a checkbox field in the PO header. The Bam runs off of this, looks up to poaprvmsg table and then sends an email , and then unticks the checkbox. Never done this, is this possible?
>
> --- In vantage@yahoogroups .com, "Brian W. Spolarich " <bspolarich@ ...> wrote:
> >
> > Is it possible to send e-mail from a 4GL BPM action?
> >
> >
> >
> > I'm refining my PO Approval notification process and I want the
> > notification to go to the person who actually has to *approve* the PO
> > (shocking idea). I looked in the list archives and didn't see anyone
> > actually doing the obvious here.
> >
> >
> >
> > Basically I want to look at PO.ChangeApproveSwi tch, and if the
> > POHeader.ApprovalSt atus = 'P' then I want to join POHeader to POApvMsg
> > and POApvMsg to PurAgent to get the e-mail address of the intended
> > approver, and send that person an e-mail.
> >
> >
> >
> > Seems straightforward except for the invocation of the e-mail piece.
> >
> >
> >
> > Alternatively I could do this as a BAM. Does anyone have an example I
> > could draw from that shows how to do a query in a BAM to find a
> > recordset and use the data in that recordset? I've done it in a BPM but
> > not a BAM and I'm not sure if there's different scaffolding required to
> > set it up.
> >
> >
> >
> > -bws
> >
> >
> >
> > --
> >
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> > Picometrix
> >
> > bspolarich@ ..
> > <mailto:bspolarich@ ...> ~ 734-864-5618 ~
> > www.advancedphotoni x.com <http://www.advanced photonix. com>
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
Crap. Well this is a lot more involved than I thought.

Somedays I hate Epicor.

So my BAM method only handles the initial notification to the first level approver. Now I also need to handle the events related to the rest of the approvals.

Looks like all of the activity happens against POApvMsg. Unfortunately you can't create Business Activity Manager rules against POApvMsg. :-) Of course not as that would be Epicor making my life easy.

However you can create BPMs against BO.POApvMsg, including Update(). So what I did this morning is write a BPM that get called as a post-processing action against POApvMsg.Update for updates to POApvMsg where MsgType = "1" (which is a request for approval, vs "2" which is the end of the process). It does the following:

find ttPOApvMsg.
for each ttPOApvMsg no-lock:
message "ttPOApvMsg.PONum: " + string(ttPOApvMsg.PONum) + "~n".
find first POHeader where POHeader.Company = ttPOApvMsg.Company and POHeader.PONum = ttPOApvMsg.PONum no-lock.
define variable ApprovalChain as character no-undo.
ApprovalChain = POHeader.ShortChar01 + "/" + ttPOApvMsg.MsgTo.
run lib\UpdateTableBuffer.p(input BUFFER POHeader:HANDLE, 'ShortChar01',ApprovalChain).
end.

Basically I'm just appending to the end of POHeader.ShortChar01 some text, in this case the buyerid that approved the request.

I then add POHeader.ShortChar01 to my list of fields that my BAM is watching, and set the criteria to be POHeader.ApprovalStatus = "P" or POHeader.ShortChar01 <> "".

This effectively means my BAM notification will fire for the initial submission of the PO to be approved (POHeader.ApprovalStatus = "P"), and also for the subsequent approval requests via PO Approvals, as POHeader.ShortChar01 only gets modified.

I just need to add a terminal notification to the requestor indicating the final disposition (A or R).

I can't believe Epicor didn't do this!

-bws

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of brychanwilliams
Sent: Wednesday, July 15, 2009 3:46 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?

Hi,

Could I ask a quick question, would this work when you have more than one tier of approvals. We have three tiers, does the field get changed to hit the trigger , even if it is just rewriting P
Thanks

--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Here's what I wound up with. It's a custom Alert action that gets triggered off of an update to POHeader.POApprovalStatus, filtered by POApprovalStatus = "P" (pending).
>
> This will send an e-mail to the approver notifying them that the Purchase Order awaits their approval.
>
> Thanks to Rob Bucek for his helpful prodding which got me going in the right direction!
>
> Here's the code:
>
> {ud/GlbAlert.i &TableName = "POHeader"}
>
> DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
>
> message "PONum: " + string(POHeader.PONum).
>
> find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
> for each PODetail of POHeader:
> POAmount = POAmount + (PODetail.DocUnitCost + PODetail.OrderQty).
> end.
>
> find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
> and POApvMsg.MsgType = "1" no-lock no-error.
>
> if available POApvMsg then do:
> message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
> find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
> if available PurAgent then do:
> find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
> if available Vendor then do:
> message "Approver E-Mail: " + PurAgent.EmailAddress.
> message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
> Assign Email-From = "vantage-alerts@...".
> Assign Email-To = PurAgent.EmailAddress.
> Assign Email-Subject = POHeader.Company + " Purchase Order Approval Notification".
> Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " requires approval.~n"
> + "----------~n"
> + "Company: " + POHeader.Company + "~n"
> + "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
> + "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
> + "Buyer: " + POHeader.BuyerID + "~n"
> + "PODate: " + string(POHeader.OrderDate) + "~n"
> + "Comments: ~n" + POHeader.CommentText + "~n".
> end.
> end.
> end.
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Brian W. Spolarich
> Sent: Tuesday, July 14, 2009 2:22 PM
> To: vantage@yahoogroups.com
> Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
> This is a great start Rob.
>
> I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)
>
> The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.
>
> -bws
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
> Sent: Tuesday, July 14, 2009 12:17 PM
> To: vantage@yahoogroups.com
> Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
> Brian, I am not quite sure about the BPM email from a 4GL action,
> however this example might be what you are after with regards to a BAM
>
>
>
> FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
> (PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.
>
> In the body of the code:
> /* Lines of Order */
> FOR EACH PODetail of POHeader no-lock:
> FIND PORel WHERE (PORel.Company = PODetail.Company) AND
> (PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
> NO-LOCK NO-ERROR.
>
> FOR EACH PORel of PODetail no-lock:
> Assign NewEmailBody = NewEmailBody
> + " Item " + STRING(PODetail.POLine) + ": "
> + STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
> + " - Due: " + STRING(PORel.DueDate)
> + " - Qty: " + STRING(PODetail.OrderQty)
> + " - Price: " + STRING(PODetail.UnitCost)
> + "~n".
> END.
> END.
>
>
>
> And another simple example..
>
>
>
> Below is one I use for emailing when a job is ready for receipt to
> stock...
>
>
>
> {ud/GlbAlert.i & TableName = "JobHead"}
>
> Assign Email-Text = "The following is ready for receipt to stock;" +
> "~tJob Number: " + string(JobHead.JobNum)
>
> + "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)
>
> + "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of Brian W. Spolarich
> Sent: Tuesday, July 14, 2009 11:04 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
>
>
>
>
>
> Is it possible to send e-mail from a 4GL BPM action?
>
> I'm refining my PO Approval notification process and I want the
> notification to go to the person who actually has to *approve* the PO
> (shocking idea). I looked in the list archives and didn't see anyone
> actually doing the obvious here.
>
> Basically I want to look at PO.ChangeApproveSwitch, and if the
> POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
> and POApvMsg to PurAgent to get the e-mail address of the intended
> approver, and send that person an e-mail.
>
> Seems straightforward except for the invocation of the e-mail piece.
>
> Alternatively I could do this as a BAM. Does anyone have an example I
> could draw from that shows how to do a query in a BAM to find a
> recordset and use the data in that recordset? I've done it in a BPM but
> not a BAM and I'm not sure if there's different scaffolding required to
> set it up.
>
> -bws
>
> --
>
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> Picometrix
>
> bspolarich@...
> <mailto:bspolarich%40advancedphotonix.com>
> <mailto:bspolarich@...
> <mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
> www.advancedphotonix.com <http://www.advancedphotonix.com>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>
>
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>




------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
Brillo

--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Crap. Well this is a lot more involved than I thought.
>
> Somedays I hate Epicor.
>
> So my BAM method only handles the initial notification to the first level approver. Now I also need to handle the events related to the rest of the approvals.
>
> Looks like all of the activity happens against POApvMsg. Unfortunately you can't create Business Activity Manager rules against POApvMsg. :-) Of course not as that would be Epicor making my life easy.
>
> However you can create BPMs against BO.POApvMsg, including Update(). So what I did this morning is write a BPM that get called as a post-processing action against POApvMsg.Update for updates to POApvMsg where MsgType = "1" (which is a request for approval, vs "2" which is the end of the process). It does the following:
>
> find ttPOApvMsg.
> for each ttPOApvMsg no-lock:
> message "ttPOApvMsg.PONum: " + string(ttPOApvMsg.PONum) + "~n".
> find first POHeader where POHeader.Company = ttPOApvMsg.Company and POHeader.PONum = ttPOApvMsg.PONum no-lock.
> define variable ApprovalChain as character no-undo.
> ApprovalChain = POHeader.ShortChar01 + "/" + ttPOApvMsg.MsgTo.
> run lib\UpdateTableBuffer.p(input BUFFER POHeader:HANDLE, 'ShortChar01',ApprovalChain).
> end.
>
> Basically I'm just appending to the end of POHeader.ShortChar01 some text, in this case the buyerid that approved the request.
>
> I then add POHeader.ShortChar01 to my list of fields that my BAM is watching, and set the criteria to be POHeader.ApprovalStatus = "P" or POHeader.ShortChar01 <> "".
>
> This effectively means my BAM notification will fire for the initial submission of the PO to be approved (POHeader.ApprovalStatus = "P"), and also for the subsequent approval requests via PO Approvals, as POHeader.ShortChar01 only gets modified.
>
> I just need to add a terminal notification to the requestor indicating the final disposition (A or R).
>
> I can't believe Epicor didn't do this!
>
> -bws
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of brychanwilliams
> Sent: Wednesday, July 15, 2009 3:46 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?
>
> Hi,
>
> Could I ask a quick question, would this work when you have more than one tier of approvals. We have three tiers, does the field get changed to hit the trigger , even if it is just rewriting P
> Thanks
>
> --- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@> wrote:
> >
> > Here's what I wound up with. It's a custom Alert action that gets triggered off of an update to POHeader.POApprovalStatus, filtered by POApprovalStatus = "P" (pending).
> >
> > This will send an e-mail to the approver notifying them that the Purchase Order awaits their approval.
> >
> > Thanks to Rob Bucek for his helpful prodding which got me going in the right direction!
> >
> > Here's the code:
> >
> > {ud/GlbAlert.i &TableName = "POHeader"}
> >
> > DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
> >
> > message "PONum: " + string(POHeader.PONum).
> >
> > find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
> > for each PODetail of POHeader:
> > POAmount = POAmount + (PODetail.DocUnitCost + PODetail.OrderQty).
> > end.
> >
> > find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
> > and POApvMsg.MsgType = "1" no-lock no-error.
> >
> > if available POApvMsg then do:
> > message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
> > find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
> > if available PurAgent then do:
> > find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
> > if available Vendor then do:
> > message "Approver E-Mail: " + PurAgent.EmailAddress.
> > message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
> > Assign Email-From = "vantage-alerts@".
> > Assign Email-To = PurAgent.EmailAddress.
> > Assign Email-Subject = POHeader.Company + " Purchase Order Approval Notification".
> > Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " requires approval.~n"
> > + "----------~n"
> > + "Company: " + POHeader.Company + "~n"
> > + "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
> > + "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
> > + "Buyer: " + POHeader.BuyerID + "~n"
> > + "PODate: " + string(POHeader.OrderDate) + "~n"
> > + "Comments: ~n" + POHeader.CommentText + "~n".
> > end.
> > end.
> > end.
> >
> > --
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> > Â Â Â Â bspolarich@ ~ 734-864-5618 ~ www.advancedphotonix.com
> >
> >
> > -----Original Message-----
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Brian W. Spolarich
> > Sent: Tuesday, July 14, 2009 2:22 PM
> > To: vantage@yahoogroups.com
> > Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> > This is a great start Rob.
> >
> > I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)
> >
> > The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.
> >
> > -bws
> >
> > --
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> > Â Â Â Â bspolarich@ ~ 734-864-5618 ~ www.advancedphotonix.com
> >
> >
> > -----Original Message-----
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
> > Sent: Tuesday, July 14, 2009 12:17 PM
> > To: vantage@yahoogroups.com
> > Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> > Brian, I am not quite sure about the BPM email from a 4GL action,
> > however this example might be what you are after with regards to a BAM
> >
> >
> >
> > FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
> > (PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.
> >
> > In the body of the code:
> > /* Lines of Order */
> > FOR EACH PODetail of POHeader no-lock:
> > FIND PORel WHERE (PORel.Company = PODetail.Company) AND
> > (PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
> > NO-LOCK NO-ERROR.
> >
> > FOR EACH PORel of PODetail no-lock:
> > Assign NewEmailBody = NewEmailBody
> > + " Item " + STRING(PODetail.POLine) + ": "
> > + STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
> > + " - Due: " + STRING(PORel.DueDate)
> > + " - Qty: " + STRING(PODetail.OrderQty)
> > + " - Price: " + STRING(PODetail.UnitCost)
> > + "~n".
> > END.
> > END.
> >
> >
> >
> > And another simple example..
> >
> >
> >
> > Below is one I use for emailing when a job is ready for receipt to
> > stock...
> >
> >
> >
> > {ud/GlbAlert.i & TableName = "JobHead"}
> >
> > Assign Email-Text = "The following is ready for receipt to stock;" +
> > "~tJob Number: " + string(JobHead.JobNum)
> >
> > + "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)
> >
> > + "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).
> >
> >
> >
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> > Of Brian W. Spolarich
> > Sent: Tuesday, July 14, 2009 11:04 AM
> > To: vantage@yahoogroups.com
> > Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> >
> >
> >
> >
> > Is it possible to send e-mail from a 4GL BPM action?
> >
> > I'm refining my PO Approval notification process and I want the
> > notification to go to the person who actually has to *approve* the PO
> > (shocking idea). I looked in the list archives and didn't see anyone
> > actually doing the obvious here.
> >
> > Basically I want to look at PO.ChangeApproveSwitch, and if the
> > POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
> > and POApvMsg to PurAgent to get the e-mail address of the intended
> > approver, and send that person an e-mail.
> >
> > Seems straightforward except for the invocation of the e-mail piece.
> >
> > Alternatively I could do this as a BAM. Does anyone have an example I
> > could draw from that shows how to do a query in a BAM to find a
> > recordset and use the data in that recordset? I've done it in a BPM but
> > not a BAM and I'm not sure if there's different scaffolding required to
> > set it up.
> >
> > -bws
> >
> > --
> >
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> > Picometrix
> >
> > bspolarich@
> > <mailto:bspolarich%40advancedphotonix.com>
> > <mailto:bspolarich@
> > <mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
> > www.advancedphotonix.com <http://www.advancedphotonix.com>
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> > (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> > (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
> >
> >
> >
> >
> >
> > ------------------------------------
> >
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> > (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> > (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
> >
>
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>
Brian:
Does the BAM you use to send this request to the appropriate individual rely on a .p file to strip out the name for the Email_to? If so, could you share what this looks like.

Thanks,
-Karl

--- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@...> wrote:
>
> Crap. Well this is a lot more involved than I thought.
>
> Somedays I hate Epicor.
>
> So my BAM method only handles the initial notification to the first level approver. Now I also need to handle the events related to the rest of the approvals.
>
> Looks like all of the activity happens against POApvMsg. Unfortunately you can't create Business Activity Manager rules against POApvMsg. :-) Of course not as that would be Epicor making my life easy.
>
> However you can create BPMs against BO.POApvMsg, including Update(). So what I did this morning is write a BPM that get called as a post-processing action against POApvMsg.Update for updates to POApvMsg where MsgType = "1" (which is a request for approval, vs "2" which is the end of the process). It does the following:
>
> find ttPOApvMsg.
> for each ttPOApvMsg no-lock:
> message "ttPOApvMsg.PONum: " + string(ttPOApvMsg.PONum) + "~n".
> find first POHeader where POHeader.Company = ttPOApvMsg.Company and POHeader.PONum = ttPOApvMsg.PONum no-lock.
> define variable ApprovalChain as character no-undo.
> ApprovalChain = POHeader.ShortChar01 + "/" + ttPOApvMsg.MsgTo.
> run lib\UpdateTableBuffer.p(input BUFFER POHeader:HANDLE, 'ShortChar01',ApprovalChain).
> end.
>
> Basically I'm just appending to the end of POHeader.ShortChar01 some text, in this case the buyerid that approved the request.
>
> I then add POHeader.ShortChar01 to my list of fields that my BAM is watching, and set the criteria to be POHeader.ApprovalStatus = "P" or POHeader.ShortChar01 <> "".
>
> This effectively means my BAM notification will fire for the initial submission of the PO to be approved (POHeader.ApprovalStatus = "P"), and also for the subsequent approval requests via PO Approvals, as POHeader.ShortChar01 only gets modified.
>
> I just need to add a terminal notification to the requestor indicating the final disposition (A or R).
>
> I can't believe Epicor didn't do this!
>
> -bws
>
> --
> Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> Â Â Â Â bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
>
> -----Original Message-----
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of brychanwilliams
> Sent: Wednesday, July 15, 2009 3:46 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: 4GL Send-Email Action or Custom BAM Alert?
>
> Hi,
>
> Could I ask a quick question, would this work when you have more than one tier of approvals. We have three tiers, does the field get changed to hit the trigger , even if it is just rewriting P
> Thanks
>
> --- In vantage@yahoogroups.com, "Brian W. Spolarich " <bspolarich@> wrote:
> >
> > Here's what I wound up with. It's a custom Alert action that gets triggered off of an update to POHeader.POApprovalStatus, filtered by POApprovalStatus = "P" (pending).
> >
> > This will send an e-mail to the approver notifying them that the Purchase Order awaits their approval.
> >
> > Thanks to Rob Bucek for his helpful prodding which got me going in the right direction!
> >
> > Here's the code:
> >
> > {ud/GlbAlert.i &TableName = "POHeader"}
> >
> > DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
> >
> > message "PONum: " + string(POHeader.PONum).
> >
> > find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
> > for each PODetail of POHeader:
> > POAmount = POAmount + (PODetail.DocUnitCost + PODetail.OrderQty).
> > end.
> >
> > find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
> > and POApvMsg.MsgType = "1" no-lock no-error.
> >
> > if available POApvMsg then do:
> > message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
> > find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
> > if available PurAgent then do:
> > find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
> > if available Vendor then do:
> > message "Approver E-Mail: " + PurAgent.EmailAddress.
> > message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
> > Assign Email-From = "vantage-alerts@".
> > Assign Email-To = PurAgent.EmailAddress.
> > Assign Email-Subject = POHeader.Company + " Purchase Order Approval Notification".
> > Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " requires approval.~n"
> > + "----------~n"
> > + "Company: " + POHeader.Company + "~n"
> > + "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
> > + "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
> > + "Buyer: " + POHeader.BuyerID + "~n"
> > + "PODate: " + string(POHeader.OrderDate) + "~n"
> > + "Comments: ~n" + POHeader.CommentText + "~n".
> > end.
> > end.
> > end.
> >
> > --
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> > Â Â Â Â bspolarich@ ~ 734-864-5618 ~ www.advancedphotonix.com
> >
> >
> > -----Original Message-----
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Brian W. Spolarich
> > Sent: Tuesday, July 14, 2009 2:22 PM
> > To: vantage@yahoogroups.com
> > Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> > This is a great start Rob.
> >
> > I'm not 100% sure how to interpret this though. I suspect I'm being dense. :-)
> >
> > The first part "FIND PODetail WHERE ..." -- where does this go? Is this part of the *.i file? 'Cause then you say "In the body of the code:" which is clearly not part of the 4GL code.
> >
> > -bws
> >
> > --
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
> > Â Â Â Â bspolarich@ ~ 734-864-5618 ~ www.advancedphotonix.com
> >
> >
> > -----Original Message-----
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Rob Bucek
> > Sent: Tuesday, July 14, 2009 12:17 PM
> > To: vantage@yahoogroups.com
> > Subject: RE: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> > Brian, I am not quite sure about the BPM email from a 4GL action,
> > however this example might be what you are after with regards to a BAM
> >
> >
> >
> > FIND PODetail WHERE (PODetail.Company = POHeader.Company) AND
> > (PODetail.PONUM = POHeader.PONum) NO-LOCK NO-ERROR.
> >
> > In the body of the code:
> > /* Lines of Order */
> > FOR EACH PODetail of POHeader no-lock:
> > FIND PORel WHERE (PORel.Company = PODetail.Company) AND
> > (PORel.PONum = PODetail.PONUM) AND (PORel.POLine = PODetail.POLine)
> > NO-LOCK NO-ERROR.
> >
> > FOR EACH PORel of PODetail no-lock:
> > Assign NewEmailBody = NewEmailBody
> > + " Item " + STRING(PODetail.POLine) + ": "
> > + STRING(PODetail.PartNum) + " " + STRING(PODetail.LineDesc)
> > + " - Due: " + STRING(PORel.DueDate)
> > + " - Qty: " + STRING(PODetail.OrderQty)
> > + " - Price: " + STRING(PODetail.UnitCost)
> > + "~n".
> > END.
> > END.
> >
> >
> >
> > And another simple example..
> >
> >
> >
> > Below is one I use for emailing when a job is ready for receipt to
> > stock...
> >
> >
> >
> > {ud/GlbAlert.i & TableName = "JobHead"}
> >
> > Assign Email-Text = "The following is ready for receipt to stock;" +
> > "~tJob Number: " + string(JobHead.JobNum)
> >
> > + "~n~t~t~t~t~t~t~t~tPart Number: " + string(JobHead.PartNum)
> >
> > + "~n~t~t~t~t~t~t~t~tRevision: " + string(JobHead.Revision).
> >
> >
> >
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> > Of Brian W. Spolarich
> > Sent: Tuesday, July 14, 2009 11:04 AM
> > To: vantage@yahoogroups.com
> > Subject: [Vantage] 4GL Send-Email Action or Custom BAM Alert?
> >
> >
> >
> >
> >
> > Is it possible to send e-mail from a 4GL BPM action?
> >
> > I'm refining my PO Approval notification process and I want the
> > notification to go to the person who actually has to *approve* the PO
> > (shocking idea). I looked in the list archives and didn't see anyone
> > actually doing the obvious here.
> >
> > Basically I want to look at PO.ChangeApproveSwitch, and if the
> > POHeader.ApprovalStatus = 'P' then I want to join POHeader to POApvMsg
> > and POApvMsg to PurAgent to get the e-mail address of the intended
> > approver, and send that person an e-mail.
> >
> > Seems straightforward except for the invocation of the e-mail piece.
> >
> > Alternatively I could do this as a BAM. Does anyone have an example I
> > could draw from that shows how to do a query in a BAM to find a
> > recordset and use the data in that recordset? I've done it in a BPM but
> > not a BAM and I'm not sure if there's different scaffolding required to
> > set it up.
> >
> > -bws
> >
> > --
> >
> > Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
> > Picometrix
> >
> > bspolarich@
> > <mailto:bspolarich%40advancedphotonix.com>
> > <mailto:bspolarich@
> > <mailto:bspolarich%40advancedphotonix.com> > ~ 734-864-5618 ~
> > www.advancedphotonix.com <http://www.advancedphotonix.com>
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> > (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> > (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
> >
> >
> >
> >
> >
> > ------------------------------------
> >
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> > (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> > (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
> >
>
>
>
>
> ------------------------------------
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
>