I couldn’t find any posts on this exact topic, so hoping someone can help.
We have several large sales order, we use DMT to upload the OrdDtl. The site record isn’t available for that DMT and our assumption has always been the DMT will default the site to the last site you were logged into on the browser. This seems to have been a safe assumption in the past, but twice now since moving to the powertools DMT, we have had the site default to a different site than the site currently logged into.
Does anyone know the actual logic for the DMT site?
The site / plant is on the OrderRel, but there is also a Plant field on the OrderHed. The plant on OrderHed should default to the plant used when creating it. Do you use DMT to upload the OrderHed too? If so, you can set the plant at the OrderHed level first.
It should default to the plant on OrderHed.Plant. Since it isn’t working that way, I would use an In-Transaction Data Directive BPM as a workaround. Add a custom code block with this code:
//
// Get new OrderRel row
//
var newRel = ttOrderRel.FirstOrDefault( x => x.Added() );
//
// Quit BPM if there is no New OrderRel or the rel is not Release 1
//
if ( newRel == null || newRel.OrderRelNum != 1 )
{
return;
}
//
// Get the Plant from OrderHed
//
string OrderHedPlant = Db.OrderHed
.Where( x => x.OrderNum == newRel.OrderNum )
.Select( s => s.Plant )
.FirstOrDefault();
//
// If OrderHedPlant exists, set Rel to match.
//
if ( !string.IsNullOrEmpty(OrderHedPlant) )
{
newRel.Plant = OrderHedPlant;
}