Hi
Add Sales Order data in PO Header
Add Custom Fields in PurchTable for Sales Order information capture for example Customer Ref.
To Insert Custom fields data in PO while creating sales order follow below code
Go to --> Purch Table -->Methods --> Right Click initFromSalesTable then select Copy Event Handlers--> Post Event Handler
Create Custom Class add above copied Event Handler
class PurchDataFromSalesTable
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(tableStr(PurchTable), tableMethodStr(PurchTable, initFromSalesTable))]
public static void PurchTable_Post_initFromSalesTable(XppPrePostArgs args)
{
PurchTable purchTable=args.getThis();
SalesTable salesTable= args.getArg("_salesTable"); // Argument Name
purchTable.SO_CustomerRef=salesTable.customerRef;
purchTable.SO_CustRequisition=salesTable.PurchOrderFormNum;
//Or Try below code
SalesTable salesTable;
purchTable.SO_CustomerRef=SalesTable::find(purchTable.InterCompanyOriginalSalesId).CustomerRef;
purchTable.SO_CustRequisition =SalesTable::find(purchTable.InterCompanyOriginalSalesId).PurchOrderFormNum;
}
}
Add Sales Order data in PO Header
Add Custom Fields in PurchTable for Sales Order information capture for example Customer Ref.
To Insert Custom fields data in PO while creating sales order follow below code
Go to --> Purch Table -->Methods --> Right Click initFromSalesTable then select Copy Event Handlers--> Post Event Handler
Create Custom Class add above copied Event Handler
class PurchDataFromSalesTable
{
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(tableStr(PurchTable), tableMethodStr(PurchTable, initFromSalesTable))]
public static void PurchTable_Post_initFromSalesTable(XppPrePostArgs args)
{
PurchTable purchTable=args.getThis();
SalesTable salesTable= args.getArg("_salesTable"); // Argument Name
purchTable.SO_CustomerRef=salesTable.customerRef;
purchTable.SO_CustRequisition=salesTable.PurchOrderFormNum;
//Or Try below code
SalesTable salesTable;
purchTable.SO_CustomerRef=SalesTable::find(purchTable.InterCompanyOriginalSalesId).CustomerRef;
purchTable.SO_CustRequisition =SalesTable::find(purchTable.InterCompanyOriginalSalesId).PurchOrderFormNum;
}
}
UriapuPgrum_shi-1989 Carol Kirby https://wakelet.com/wake/6feaAUzuEK40p3pMB-VdO
ReplyDeletetoduconsa