Hello,
I have created some custom validation fields that are specific to an order. When I conducted my testing, it brings these fields over. I figured out how to disable the native ‘Copy/Paste’ functionality, lots of good information here from the community on that, however, sales orders have one other option- ‘Copy Order’ action. I have tried field defaulting, field updating, and row inserted event handlers. None of them trigger to nullify my target fields. I have looked through the source code and tried to attach to the IsCopyOrder attribute, which I think would work- but I don’t think any of the events are firing.. any help would be great. One of the ways I have tried doing it below- it prevents the Copy/Paste perfectly, but no luck with the IsCopyOrder side of it.
protected void SOOrder_UsrBlyReviewedBy_FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs e)
{
if (e.Row is null) return;
var row = (SOOrder)e.Row;
if (Base.IsCopyPasteContext || Base.IsCopyOrder)
{
e.NewValue = null;
}
}
I have tried FieldDefaulting, as that is presenting itself a lot in these forum posts and what is used in the native logic of the Copy Order action, but unfortunately, that isn’t having the same effect for me.. not sure if there is something I might be missing in the field setups? Field setup below:
#region UsrBlyReviewedBy
[PXDBGuid]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXSelector(typeof(Search<Users.pKID>),
SubstituteKey = typeof(Users.username))]
[PXUIField(DisplayName = "Reviewed By", Enabled = false)]
public virtual Guid? UsrBlyReviewedBy { get; set; }
public abstract class usrBlyReviewedBy : PX.Data.BQL.BqlGuid.Field<usrBlyReviewedBy> { }
#endregion
Any help would be greatly appreciated!