How to hide a field while copy and past. The field is part of the extension of the sales order.DAC.
I have tried [PXCopyPasteHiddenFields(typeof(PSSOOrderExtNV.usrIsInHandsDate))] and I am getting the following compilation error.
Error CS0592 Attribute 'PXCopyPasteHiddenFields' is not valid on this declaration type. It is only valid on 'class, field' declarations.
I have tried to Override the method CopyPasteGetScript I did not get the desired result.
public delegate void CopyPasteGetScriptDelegate(Boolean isImportSimple, List<Command> script, List<Container> containers);
[PXOverride]
public void CopyPasteGetScript(Boolean isImportSimple, List<Command> script, List<Container> containers, CopyPasteGetScriptDelegate baseMethod)
{
baseMethod(isImportSimple, script, containers);
SOOrder order = Base.Document.Current;
if(Base.Document.Cache.GetStatus(order) == PXEntryStatus.Inserted)
{
PSSOOrderExtNV extn = PXCache<SOOrder>.GetExtension<PSSOOrderExtNV>(order);
extn.UsrHoldUntil = null;
extn.UsrReadyforProductionapproval = null;
extn.UsrReadyForProduction = null;
extn.UsrIsOrdered = null;
extn.UsrIsAllocated = null;
extn.UsrEmbPaperReceived = null;
extn.UsrEmbGoodsReceived = null;
extn.UsrWorksheetPrinted = null;
extn.UsrGoodsOnCarts = null;
Base.Document.Update(order);
}
}
Update
I have modified the code as bellow in graph extension of SOOrderEntry. It is not giving error while compiling, but it is copying the values to new order.
[PXCopyPasteHiddenFields(typeof(SOOrder.cancelled), typeof(SOOrder.preAuthTranNumber), typeof(SOOrder.ownerID), typeof(SOOrder.workgroupID),
typeof(PSSOOrderExtNV.usrHoldUntil),typeof(PSSOOrderExtNV.usrReadyForProduction),typeof(PSSOOrderExtNV.usrReadyforProductionapproval),typeof(PSSOOrderExtNV.usrIsOrdered),
typeof(PSSOOrderExtNV.usrIsAllocated),typeof(PSSOOrderExtNV.usrEmbPaperReceived),typeof(PSSOOrderExtNV.usrEmbGoodsReceived),typeof(PSSOOrderExtNV.usrWorksheetPrinted),
typeof(PSSOOrderExtNV.usrGoodsOnCarts))]
public PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Current<SOOrder.orderType>>, And<SOOrder.orderNbr, Equal<Current<SOOrder.orderNbr>>>>> CurrentDocument;