Create sales order with bpm

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”);

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.

Thanks, I just did it using workflow designer: