Creating BAM For New Sales Order

Mark:
Â
 The .p Customization we use we coded ourselves.

--- On Thu, 8/6/09, Trzaska, Mark <mtrzaska@...> wrote:


From: Trzaska, Mark <mtrzaska@...>
Subject: [Vantage] Re: Creating BAM For New Sales Order
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Date: Thursday, August 6, 2009, 11:37 AM


Â



How much did that customization cost if I may ask?

-----

Stanley Machining's website has a new look.
Please visit us at: www.stanleymachinin g.com

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



















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

I want to create a BAM (Global alert) that will send e-mail once a new order is entered.Does anyone have any ideas on the simplest way to do this. Or does someone already have this done. version 8.04.408.

Thanx
We are about to put this in place as well. Below is the alert program code we've come up with:

/* Send email whenever a Sales Order is taken off hold */
{ud/GlbAlert.i &TableName = "OrderHed"}

DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
DEFINE VARIABLE RepCode AS CHARACTER NO-UNDO.
DEFINE VARIABLE CustEmail AS CHARACTER NO-UNDO.
DEFINE VARIABLE RepEmail AS CHARACTER NO-UNDO.

ASSIGN RepCode = SUBSTRING((OrderHed.SalesRepList + "~~"), 1, INDEX((OrderHed.SalesRepList + "~~"),"~~") + -1).

FIND Customer WHERE Customer.Company = OrderHed.Company AND Customer.CustNum = OrderHed.BTCustNum NO-LOCK.
FIND OrderDtl WHERE OrderDtl.Company = OrderHed.Company AND OrderDtl.Ordernum = Orderhed.OrderNum NO-LOCK no-error.
FIND ShipTo WHERE ShipTo.Company = OrderHed.Company and ShipTo.CustNum = OrderHed.CustNum and ShipTo.ShipToNum = OrderHed.ShipToNum no-lock no-error.
FIND SalesRep WHERE SalesRep.Company = OrderHed.Company and SalesRep.SalesRepCode = RepCode no-lock no-error.

/* Don't send email if order is closed */
If NOT (orderhed.openorder) THEN DO:
RETURN "CANCEL SEND":U.
END.


/* Assign default customer email address in case the Customer and Ship-To don't have one */
ASSIGN CustEmail = "cust_support@...".
IF Customer.EmailAddress NE "" THEN ASSIGN CustEmail = Customer.EmailAddress.
IF ShipTo.EmailAddress NE "" THEN ASSIGN CustEmail = ShipTo.EmailAddress.

/* Assign default rep email address in case the SalesRep doesn't have one */
ASSIGN RepEmail = "cust_support@...".
IF SalesRep.EmailAddress NE "" THEN ASSIGN RepEmail = SalesRep.EmailAddress.


ASSIGN Email-To = CustEmail + "," +RepEmail.
ASSIGN Email-Subject = "New Sales Order# " + STRING(OrderHed.OrderNum).


/* Create the new body of the email */
ASSIGN NewEmailBody = "~n(Correct email addresses: Customer: " + STRING(CustEmail) + "~tRep: " + STRING(RepCode) + "~temail: " + STRING(RepEmail) + ")"
+ "~n~nDear Customer"
+ "~n~nWe have just entered a new sales order onto our system for you. The details are as follows:"
+ "~n~n Order Number: " + STRING(OrderHed.OrderNum)
+ "~n Order Date: " + STRING(Orderhed.OrderDate)
+ "~n Your PO Number: " + STRING(Orderhed.PONum)
+ "~n~n Bill to: " + STRING(Customer.Name) + ", " + STRING(Customer.Address1) + ", " + STRING(Customer.City) + ", " + STRING(Customer.State) + ", " + STRING(Customer.ZIP)
+ "~n Ship to: " + STRING(ShipTo.Name) + ", " + STRING(ShipTo.Address1) + ", " + STRING(ShipTo.City) + ", " + STRING(ShipTo.State) + ", " + STRING(ShipTo.ZIP)
+ "~n Expected Ship Date: " + (IF OrderHed.RequestDate = ? THEN "see below" ELSE STRING(orderhed.RequestDate)).

ASSIGN NewEmailBody = NewEmailBody
+ "~n~nIf you have any queries on this order please contact Customer Service, quoting the above order number, on:"
+ "~n Tel: (###) ### #### Fax: (###) ### #### Email: sales@..."
+ "~n~n~nThank you,~n~nOur Company, Inc,~n123 Main St,~nNew York,~nNY 12345"
+ "~n~n~nDO NOT REPLY TO THIS E-MAIL ACCOUNT, IT DOES NOT GET REVIEWED!".



/* Lines of Order */
ASSIGN NewEmailBody = NewEmailBody
+ "~n~n~nOrder Lines:~n".
FOR EACH OrderDtl of OrderHed no-lock:
Assign NewEmailBody = NewEmailBody
+ " Item " + STRING(OrderDtl.OrderLine) + ":~t"
+ STRING(OrderDtl.PartNum) + " " + STRING(OrderDtl.LineDesc)
+ ":~t" + STRING(OrderDtl.OrderQty) + " piece(s)"
+ (IF OrderHed.RequestDate = ? THEN ":~tShip By: "
+ STRING(OrderDtl.RequestDate) ELSE "")
+ "~n".
END.

/* Print Email Body */
ASSIGN Email-Text = NewEmailBody


HTH,

Nigel.


--- In vantage@yahoogroups.com, "jesh1975" <jesh1975@...> wrote:
>
> Hello all,
>
> I want to create a BAM (Global alert) that will send e-mail once a new order is entered.Does anyone have any ideas on the simplest way to do this. Or does someone already have this done. version 8.04.408.
>
> Thanx
>
Thanx Nigel couple of questions.

I should have been more specific (my fault) i noticed you send the e-mail once order is taken off hold. We dont really do it that way. I was referring to when an actual NEW order is entered into the system. Then i (it) would send e-mails out to people within our organization so they know whats new coming in.



-----

Stanley Machining's website has a new look.
Please visit us at: www.stanleymachining.com
That's what we want as well.

But there has to be something triggered to tell Vantage that the new order is finished being entered. You could ask your order-entry users to tick, say, AutoPrintReady and use that to trigger the BAM but we find that users sometimes forget to do this.

So we have a BPM in place that puts all new orders On Hold ("yellow" hold, not credit hold). When the user is finished entering, they take the order off hold and the BAM is triggered. There's a much better chance of the user seeing the yellow warning than just ticking a box.

Nigel.

--- In vantage@yahoogroups.com, "Trzaska, Mark" <mtrzaska@...> wrote:
>
> Thanx Nigel couple of questions.
>
> I should have been more specific (my fault) i noticed you send the e-mail once order is taken off hold. We dont really do it that way. I was referring to when an actual NEW order is entered into the system. Then i (it) would send e-mails out to people within our organization so they know whats new coming in.
>
>
>
> -----
>
> Stanley Machining's website has a new look.
> Please visit us at: www.stanleymachining.com
>
The problem is determining when its a "new" order. The order header and line items gets saved each time a new line is added to the order, and I wouldn't think you would want an email going out each time an item is added, this would drive everyone crazy. We have a customization where our customer service department hits a button to send out the order by email when they have finished entering everything. After the button is pressed and the email sent, the button is disabled so that they don't accidentally send out another one.




________________________________
From: "Trzaska, Mark" <mtrzaska@...>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Wednesday, August 5, 2009 12:22:01 PM
Subject: [Vantage] Re: Creating BAM For New Sales Order

Â
Thanx Nigel couple of questions.

I should have been more specific (my fault) i noticed you send the e-mail once order is taken off hold. We dont really do it that way. I was referring to when an actual NEW order is entered into the system. Then i (it) would send e-mails out to people within our organization so they know whats new coming in.

-----

Stanley Machining's website has a new look.
Please visit us at: www.stanleymachinin g.com






[Non-text portions of this message have been removed]
Mark:
Â
     I tried posting some code and it never made it. We have an alert that seems to work for us, ver 6.10.541 - let me know if you want to take a look at it.
fuji36@...
Â
Bill J.

--- On Wed, 8/5/09, Trzaska, Mark <mtrzaska@...> wrote:


From: Trzaska, Mark <mtrzaska@...>
Subject: [Vantage] Re: Creating BAM For New Sales Order
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Date: Wednesday, August 5, 2009, 12:22 PM


Â



Thanx Nigel couple of questions.

I should have been more specific (my fault) i noticed you send the e-mail once order is taken off hold. We dont really do it that way. I was referring to when an actual NEW order is entered into the system. Then i (it) would send e-mails out to people within our organization so they know whats new coming in.

-----

Stanley Machining's website has a new look.
Please visit us at: www.stanleymachinin g.com


















[Non-text portions of this message have been removed]
How much did that customization cost if I may ask?




-----

Stanley Machining's website has a new look.
Please visit us at: www.stanleymachining.com

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