Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
dosborn
Posts: 25
Registered: 12-15-2011
0
Accepted Solution

Invoke Sales Order Copy From

Is there a way to programmatically invoke the Sales Order Copy From functionality so that I can essentially pass in an existing sales order to a copy from method and get returned a new sales order number?

Moderator
Natasha
Posts: 180
Registered: 07-15-2009

Re: Invoke Sales Order Copy From

SO_SalesOrder_bus has a CopyFromOrder method.  It doesn't assign a new sales order number.  You need to set a new order number, copy another order, then write the new order.

 

CopyFromOrder(order$, type$, clearJob, copyMemos)

 

order$ = the order to copy

type$ = the new order type (eg. "S" for standard)

clearJob = to clear job information on the order or not

copyMemos = to copy order memo or not

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Contributor
dosborn
Posts: 25
Registered: 12-15-2011
0

Re: Invoke Sales Order Copy From

I get that the object doesn't support this property or method.  I am guessing I am not doing something quite right:

 

Set order = oScript.NewObject("SO_SalesOrder_bus", oSS)
With order
     strNewOrderNo = ""
     .nGetNextSalesOrderNo strNewOrderNo
     .nSetKey strNewOrderNo
     .CopyFromOrder strOrderNo, orderType, false, true
     .nWrite
End With

 

Regular Contributor
Gator
Posts: 272
Registered: 12-05-2008

Re: Invoke Sales Order Copy From

.CopyFromOrder

 

missing the 'n'

 

You can also use order.sLastErrorMsg to see if the commands are succeeding or not.

Sage Employee
jepritch
Posts: 237
Registered: 08-25-2009
0

Re: Invoke Sales Order Copy From

Hi dosborn,

 

You'll have to either replace orderType with "S" or some other value.   Also, it should be nCopyFromOrder

 

Elliott

Contributor
dosborn
Posts: 25
Registered: 12-15-2011
0

Re: Invoke Sales Order Copy From

Thanks, can't believe I didn't notice that.