# Create sales order with bpm

**URL:** <https://www.epiusers.help/t/create-sales-order-with-bpm/77532>\
**Category:** Epicor ERP 10\
**Tags:** bpm\
**Created:** [April 12, 2021, 9:17pm UTC](https://www.epiusers.help/t/create-sales-order-with-bpm/77532 "2021-04-12T21:17:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alopez](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/97f17d/32.png) [@alopez](https://www.epiusers.help/u/alopez)\
**Post date:** [April 12, 2021, 9:17pm UTC](https://www.epiusers.help/t/create-sales-order-with-bpm/77532/1 "2021-04-12T21:17:58Z")

</div>

We have an UD Form where we register some pre-sales orders and now I’m trying to create a real sale order from there, I’m using this code but the OrderNum is always 0, How can I get the sequence?

`
string orderNum = "";
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
OrderHed newOrderHed = new OrderHed();
Db.OrderHed.Insert(newOrderHed);
newOrderHed.Company = Session.CompanyID;
newOrderHed.CustNum = 270;
newOrderHed.ShipToNum = “”;
newOrderHed.OrderDate = DateTime.Now;
newOrderHed.NeedByDate = DateTime.Now;
newOrderHed.TermsCode = “0D”;
newOrderHed.CurrencyCode = “MXP”;
Db.Validate();
txScope.Complete();
orderNum = newOrderHed.OrderNum.ToString();
}
`

`this.PublishInfoMessage(orderNum, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, “Application Name”, “Comments”);
`

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [April 12, 2021, 9:38pm UTC](https://www.epiusers.help/t/create-sales-order-with-bpm/77532/2 "2021-04-12T21:38:06Z")

</div>

You should use the BO Methods available in Epicor. The wizard will actually create the proper code for you.  
Tools \> Wizards \> Customization Wizard and then Business Logic Method Call.

---

<div class="post-metadata">

**Author:** ![alopez](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/97f17d/32.png) [@alopez](https://www.epiusers.help/u/alopez)\
**Post date:** [April 12, 2021, 9:50pm UTC](https://www.epiusers.help/t/create-sales-order-with-bpm/77532/3 "2021-04-12T21:50:49Z")

</div>

Thanks, I just did it using workflow designer:

 ![image](https://www.epiusers.help/uploads/default/original/3X/6/4/64617ddbbb38767acfd99c28289aa1e0e46f9c55.jpeg)
