Good day,
I have created a new custom field named transport on the opportunities, sales quote, sales order and invoices and memoβs screen.
I would like the value entered in the custom field to carry over to the sales quote, sales order and invoices and memo screen when a new one is created.
Currently the value already carries over to sales quotes, since it uses the same DAC as opportunities.
Any help on how to be able to achieve this would be great.
Solved
Retreive value from one DAC and use it in another
Best answer by Naveen Boga
Hi
public PXAction<CROpportunity> createSalesOrder;
[PXUIField(DisplayName = Messages.CreateSalesOrder, MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Select)]
[PXButton]
public virtual IEnumerable CreateSalesOrder(PXAdapter adapter)
{
PXGraph.InstanceCreated.AddHandler<SOOrderEntry>((graph) =>
{
graph.RowInserted.AddHandler<SOLine>((cache, args) =>
{
var soOrderLine = (SOLine)args.Row;
KNSOLineExt soOrderLineExt = soOrderLine.GetExtension<KNSOLineExt>();
foreach (CROpportunityProducts line in Base.Products.Select().FirstTableItems.ToList().Where(x=>x.InventoryID == soOrderLine.InventoryID))
{
CROpportunityProductsExt lineExt = line.GetExtension<CROpportunityProductsExt>();
soOrderLineExt.UsrTransport = lineExt.UsrTransport;
graph.Transactions.Cache.Update(soOrderLine);
}
});
});
return Base.createSalesOrder.Press(adapter);
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.