如何从机会将订单项自定义字段值传递给销售订单? [英] How to pass line item custom field value to sales order from opportunity?
本文介绍了如何从机会将订单项自定义字段值传递给销售订单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在商机产品选项卡中有一个自定义行号字段,供客户对所选产品进行重新排序,并且网格按自定义字段值排序。
I have a custom line number field in opportunity product tab for customer to re-sequence the selected products and the grid is sorted on custom field value.
我正在尝试将价值从机会传递给同样具有类似字段的销售订单。
I am trying to pass the value from opportunity to sales order which also having a similar field.
以下代码我已经尝试过并且没有用
the following code i have tried and it did not work
PXGraph.InstanceCreated.AddHandler<SOOrderEntry>((graph) =>
{
graph.RowUpdated.AddHandler<SOLine>((cache, args) =>
{
CROpportunityProducts product = (adapter.View.Graph as OpportunityMaint).Products.Current;
CROpportunityProductsExtNV productext = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExtNV>(product);
SOLine soline = (SOLine)args.Row;
SOLineExtNV solineext = PXCache<SOLine>.GetExtension<SOLineExtNV>(soline);
solineext.UsrLineNo = productext.UsrLineNo;
});
});
下面的代码为所有行号返回相同的值
The following piece of code returns same value for all line numbers
推荐答案
您可以按照以下方式实现RowInserting事件处理程序:
You can implement RowInserting Event handler as below:
graph.RowInserting.AddHandler<SOLine>((cache, args) =>
{
var soLine = (SOLine)args.Row;
CROpportunityProducts opProduct = PXResult<CROpportunityProducts>.Current;
SOLineExtNV soLineExt = PXCache<SOLine>.GetExtension<SOLineExtNV>(soLine);
CROpportunityProductsExtNV opProductExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExtNV>(opProduct);
soLineExt.UsrLineNo = opProductExt.UsrLineNo;
});
这篇关于如何从机会将订单项自定义字段值传递给销售订单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文