Help duplicating PO Receipts via BPM

I’m trying to duplicate the PO receipt that is being done. So the user can key in a receipt, specify the # of pallets and I want to creeate thos additional receipts( pallets ) for that line.
So if the user keys in 1000 and # of pallets is 10, then I will create 9 additional PO receipts for that line. I’m duplicating every field except Packline and rowguid. I’m using
Erp.Tablesets.ReceiptTableset rcvData = new Erp.Tablesets.ReceiptTableset();
rcvSvc.GetNewRcvDtl( ref rcvData, VendorNum, PurPoint, PackSlip );

rcvData.RcvDtl[0].Company = Company ;
rcvData.RcvDtl[0].VendorNum = VendorNum ;
rcvData.RcvDtl[0].PurPoint = PurPoint ;
rcvData.RcvDtl[0].PackSlip = PackSlip ;
++PackLine ;
rcvData.RcvDtl[0].PackLine = PackLine ;
all the other fields…
rcvSvc.Update(ref rcvData );

I’m getting the error “A Valid our quantity is required.” and I’m loading the ourqty field with the saved ourqty from the table coming in on postprocess.

Thanks!

You are always updating the first record instead of the last record if you use [0].

Jason,

Ok, How do I reference the record I just added?

Thanks a bunch!

Mike

var rcvDtlRow = rcvData.RcvDtl.Where(R => R.Added()).First();
rcvDtlRow.Company = CompanyID;
...

Jason,

Ok, it looks like your example is adding it to the table and I’m adding it through the BO.

I tried to use your reference below and it gives an error when doing the syntax check saying “Does not contain a reference for “ fieldname.

This is my 2nd bpm so I really don’t know what I’m doing.

Thx

mc

Share your code so far.

Jason Woods
http://LinkedIn.com/in/jasoncwoods

Jason,

I did in my 1st
Post. I showed a few fields being loaded but the rest
Of my
Code is just
Moving fields.

Thx
Mike

Well, based on your code above, it would look like this:

Erp.Tablesets.ReceiptTableset rcvData = new Erp.Tablesets.ReceiptTableset();
rcvSvc.GetNewRcvDtl( ref rcvData, VendorNum, PurPoint, PackSlip );

var rcvDtlRow = rcvData.RcvDtl.Where(R => R.Added()).First();
rcvDtlRow.Company = CompanyID;
rcvDtlRow.VendorNum = VendorNum ;
rcvDtlRow.PurPoint = PurPoint ;
rcvDtlRow.PackSlip = PackSlip ;
++PackLine ;
rcvDtlRow.PackLine = PackLine ;
all the other fields…
rcvSvc.Update(ref rcvData);

Jason,
I will definitely try it.
I would think rcvdata would
Come back with the new record ready to go.
Thx!!!
Mc

It does, but if you had more than one detail record, you were trying to overwrite the first one each time.

You could have written:

rcvData.RcvDtl[rcvData.RcvDtl.Count -1].Company;

Jason,

Here’s the top of my code to recv in the new record.

var rcvdtlRel = ds.RcvDtl;

foreach( var rel in rcvdtlRel)
{

int company = rel.company;

……… for all of the fields.

I changed my code to use

I’m sorry, I don’t understand…

Jason,

I figured it out. There is another field that has to be built named, InputOurQty when the BO is used.

I looked on the screen for doing PO Receipts and the field is InputOurQty.

I used that and away it went.

Thanks for your help!

Mike