BPM to change data in another table


(Andrew Koemm) #1

I am writing a BPM in the Order Release table. But at the same time I need it to change data in the Part Detail table. How to I go about doing that? Thanks!


(Jason Woods) #2

The best way is to use a BPM that performs the SalesOrder.MasterUpdate method. This will update the PartDtl table properly and keep them in sync. Otherwise, C# code is the only other way I know.


(Chris Conn) #3

figure out what your link is, i’ll write some pseudo code (since I dont know if it will compile lol)

foreach(var so in ttOrderRel.Where(o => o.Updated() || o.Added()))
{
 var myPart = Db.Part.Where(p => p.Company == o.Company && p.PartNum == o.PartNum).FirstOrDefault();
 
  if(myPart != null)
{
 //heres your part
}
 
}

(Andrew Koemm) #4

In the SalesOrder.MasterUpdate method, it does not give me the option to set a field in PartDtl. Are there any documents that cover similar scenarios like this?

image

image


(Alejandro Cortes) #5

Are you invoking the BO method?


(Andrew Koemm) #6

I am not. Should i be?


(Jason Woods) #7

Yes. That is how PartDtl will get updated.


(Andrew Koemm) #8

I am sorry. I am at a loss. I have no idea how to accomplish this using the invoking BO method.


(Jason Woods) #9

The SalesOrder.Update Method (as well as MasterUpdate and UpdateExt) will update the PartDtl table properly.
I wish that OrderRel has triggers that updated PartDtl, but alas…
In 10.1.500+ (I believe), there is a widget that allows you to call a BO/Method.