Function to return serial from job - anyone ever done this?

I have made an EFx to issue material to a job, to include options for a single serial or lot number. I made a separate one to return material, and it works mostly, but I haven’t figured out how to return serial numbers.

I was surprised that (1) there’s not a lot of chatter on here about IssueReturn (the biz obj) because if anything needs to be streamlined, issuing material is high on that list. And (2) there seems to be no one that’s specifically tackled returning serial-tracked material - and shared their code.

So I’ll just ask generically if anyone has any tips if they’ve ever done this. I figured since I had conquered issuing serial numbers, that returning them would be a cinch. Nope.

Error(s) are:

There are no records in the table dsIssue.SelectedSerialNumbers

The number of serial numbers you have selected doesn't match the number required. You have 0 serial numbers selected. You must select 1 serial numbers.

My work in progress is below if you are interested. Widgets!

Tulip2.efxb (762.7 KB)

Also, credit for the bulk of this goes to @jdtrent whose code I widgetized from this post:

As expected, the failure is - selecting the serial numbers!

In code-speak, I am doing this:

  1. Use GetByID method on the SerialNo object to create a temp table
  2. Use Fill Table By Query to take the data from step 1 and add a row to the SelectedSerialNumbers table inside the IssueReturn dataset

Oh, FYI, I have two different functions - one for issues and one for returns. So, this “fill table” strategy worked perfectly in my issue-material EFx, but it’s not cutting it in the return EFx.

image

Also, the trace shows some imaginary method for adding serial numbers, so that doesn’t help:

<tracePacket>
  <businessObject>Erp.Proxy.BO.SelectedSerialNumbersImpl</businessObject>
  <methodName>AddSerialNum</methodName>

Yeah, that “proxy” thing is not something I can access.

I’m looking at the ‘Map table to ds’ widget and I noticed you didn’t set the TransType there. I’m wondering if that could be the issue as I don’t think it’s set by default when you do the GetNew. Try to set that and see if it works - you could do a trace and see what the correct values are for both issue and return.
You said that the function for issue material works - if you look in Serial Number Tracker, do you see the correct transaction types there ?

LE: the MyQuery you’re using to update the SN’s, you have the filter there SNStatus=‘INVENTORY’ - are you sure that’s correct for returning the materials ?

2 Likes

I figured it out. Really, really dumb of me. I had the old criteria on the query.

  • Was SNStatus = “INVENTORY”
  • Now it’s SNStatus = “CONSUMED”

Really, I’m not even sure why I filtered it at all. I did get by ID.

And you just figured it out, too, as I was typing.

1 Like

Well, I do thank you, @Dragos for the sanity check. I did also change the type to MTL-STK; maybe that was needed, maybe not.

I’ll hopefully wrap this thing up and post it in the code sharing section.

1 Like

No problem. Check the Serial Number Tracker for the material you ran the function for. In the Transactions tab, you have all the transactions there just like the Part Transaction History Tracker. See if the TranType is correct there.

Yep, I did after your suggestion. That’s what I used.

1 Like

I finished it:

https://www.epiusers.help/t/epicor-function-to-issue-and-return-material/93575