Insert the field from Sales Table to WMSPickingRoute table in D365 :
Req : I have custom field (IsSalesRequierd) in sales table, so same field I need to develop in WMSPickingRoute table also. This only when reference type as sales in picking route .
Note : Only Insert
Sol :
1) go to the WMSPickingRoute table > Events> On Inserting>right click> Copy event handler option
2) Create class
class WMSPickingRouteTable_EventHandler
{
[DataEventHandler(tableStr(WMSPickingRoute), DataEventType::Inserting)]
public static void WMSPickingRoute_onInserting(Common sender, DataEventArgs e)
{
WMSPickingRoute wMSPickingRoute = sender as WMSPickingRoute;
SalesTable salesTable;
if(wMSPickingRoute.transType == InventTransType::Sales)
{
select firstonly IsSalesRequierdfrom salesTable
where salesTable.SalesId == wMSPickingRoute.transRefId;
wMSPickingRoute.IsSalesRequierd= salesTable.IsSalesRequierd;
}
}
}
No comments:
Post a Comment