🤔 Anyone Know How Customer Parts Get Auto Created on Sales Order

Not sure who is aware of this little feature, but when entering a Sales Order line if you enter a Customer Part Number, Epicor will automatically create the cross reference to your internal part number. Pretty nifty feature, but you cannot enter a Customer Part Number Description, it just takes your internal part number description.

I traced the transaction. I entered the Customer Part Number and tabbed off. Checked the Xref and it was not created yet. Went back and clicked save. Checked the Xref and it was there!

I went through the trace and there was nothing that appeared to create the record. Network tab did not have anything other than the MasterUpdate.

So, how does it get created? Anyone know? I am guessing it is a db trigger or something but do not know how to track it down.

2 Likes

Maybe go into the Customer Part Cross Reference and add a new one there with trace/debugging?

I also recently came across this behavior and also discovered that if my customer part has a different description from our part number, that changing the customer part in Sales Order Entry updates the part description to the description entered for the Customer Part.

1 Like

I could just write my own event in app studio, but I would rather piggy back off of what epicor does instead.

:face_without_mouth: Odd that it’s not showing up in a trace.

That is what is making me think it is a db trigger or something. I don’t know, I’m in over my knowledge. :laughing:

1 Like

Its a Data Write Trigger on OrderDtl. So it wo’nt be easy to catch.

5 Likes

Um, could you dumb that down? :laughing:

Or expand the explanation?

1 Like

It is the equivalent of a Databse Trigger. There is a piece of logic that says

IF you are writing to the OrderDtl table check if an XPartNum exists, if it doesn’t lets create it or update it

It is essentially an In-Tran Data Directive (that you can’t see)

4 Likes

Here’s what I would recommend

Add a CallContextBpm.Character01 to the screen and called Customer Part X Ref Description.

Create a Order.Update post processing BPM that says IF we just updated an ORder Line
Check to see if we got a CustXPart cross reference and if we do update the Description with the value stored in CallContext.Charcter01

4 Likes

Awesome! Thanks for explaining.

So, that would be very hard to intercept with data you have on the order line. Best way would be to put a BPM on MasterUpdate after to then go and take the part number and description (from a UD field) and update the record that was just created?

2 Likes

Yup, just recommended exactly that above we crossed streams! :stuck_out_tongue:

3 Likes

Harold Ramis Dont Cross The Streams GIF by Ghostbusters

harold ramis well cross the streams GIF by Ghostbusters

bill hudson ghostbusters GIF

4 Likes

Hmmm I have an idea… that I kinda like better… Let me play for a min

mad scientist bartender GIF

3 Likes

Ok so after some mad science here’s where I landed. I don’t have time to write the whole thing but here’s the basic mechanism.

You’ll have to bring in Erp.Internal.Lib.Shared.dll

Pre Processing Bpm on Order.MasterUpdate

Condition:

Custom Code Widget:


var orderDtl = this.ds.OrderDtl.Where(r=>r.Added()||r.Updated()).FirstOrDefault();
//Checks to see if this is a new CustXRef and  if it is you can store a special Key in the ErpContext which can then be read all the way down at the Trigger / Data Directive.
if(!(from xC in Db.CustXPrt where xC.Company == orderDtl.Company && xC.PartNum == orderDtl.PartNum && xC.XPartNum == orderDtl.XPartNum select 1).Any())
{
  if(Erp.Internal.Lib.ErpCallContext.ContainsKey("MONKEY"))
  {
    Erp.Internal.Lib.ErpCallContext.RemoveValue("MONKEY");
  }
  Erp.Internal.Lib.ErpCallContext.Add("MONKEY","1234"); // Here you can store the description you want to use on the other side. Pull it from CallContext or a UD field... 
}

Data Directive:
In - Transasction on CustXPrt
Custom Code:

if(Erp.Internal.Lib.ErpCallContext.ContainsKey("MONKEY"))
{
  this.ttCustXPrt.FirstOrDefault().PartDescription = Erp.Internal.Lib.ErpCallContext.GetValue("MONKEY").ToString(); //Pull the value out of the Context
Erp.Internal.Lib.ErpCallContext.RemoveValue("MONKEY"); //Clear it
}

4 Likes

Thanks

Think Sesame Street GIF

4 Likes

No Relation @klincecum :rofl:

1 Like

I knew if he said it three times @klincecum would show up

4 Likes

If you had been on our call yesterday you would understand how funny this truly is.

1 Like

Must have missed my invite in the mail.

1 Like