I have created a field in PO Header, it contains certain values, while creating a new document using “Copy” function, how can i restrict copying of that UDF value.
Best answer by Naveen Boga
View originalI have created a field in PO Header, it contains certain values, while creating a new document using “Copy” function, how can i restrict copying of that UDF value.
Best answer by Naveen Boga
View originalHi Naveen,
The below code brings me no luck for “do NOT copy of UDF value” while creating new document from old ones.
protected virtual void POOrder_UsrForecastSupplierPayment_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
var row = (POOrder)e.Row;
if (this.Base.IsCopyPasteContext)
{
e.NewValue = "";
e.Cancel = true;
return;
}
}
Its not working for System field as well
protected virtual void POOrder_OrderDesc_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
var row = (POOrder)e.Row;
POOrder ord = e.Row as POOrder;
if (ord == null) return;
if (Base.IsCopyPasteContext)
{
e.NewValue = "";
e.Cancel = true;
return;
}
}
FYI i am working on 2020R2 Version.
Hi
There is another way probably you may looking of this. Please find the sample code for your reference. Hope this helps!!
if (this.IsCopyPasteContext)
{
sender.SetValue<SOOrder.usrCustomField1>(row, string.Empty);
}
Hi Naveen,
Thanks for your prompt response, I want to know one thing.
Hi
Replace usrTestField1 with your Custom Field.
public class POOrderEntryExt : PXGraphExtension<POOrderEntry>
{
[PXViewName(PX.Objects.PO.Messages.POOrder)]
[PXCopyPasteHiddenFields(typeof(POOrderExt.usrTestField1), typeof(POOrderExt.usrTestField2))]
public PXSelectJoin<POOrder,
LeftJoinSingleTable<Vendor, On<Vendor.bAccountID, Equal<POOrder.vendorID>>>,
Where<POOrder.orderType, Equal<Optional<POOrder.orderType>>,
And<Where<Vendor.bAccountID, IsNull,
Or<Match<Vendor, Current<AccessInfo.userName>>>>>>> Document;
[PXCopyPasteHiddenFields(typeof(POOrderExt.usrTestField1), typeof(POOrderExt.usrTestField2))]
public PXSelect<POOrder, Where<POOrder.orderType, Equal<Current<POOrder.orderType>>,
And<POOrder.orderNbr, Equal<Current<POOrder.orderNbr>>>>> CurrentDocument;
}
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.