Skip to main content
Answer

How can I customize Release Process logic in Release AP Documents Screen

  • June 27, 2023
  • 3 replies
  • 250 views

Forum|alt.badge.img+1

I want to customize Release process logic on Release AP Documents screen. Although I override the Release logic using ReleaseDelegate method on APInvoiceEntry Graph, the logic is not triggering when I Release AP Documents from Release AP Documents screen. 

Any idea or suggestion?

Best answer by Naveen Boga

Hi @charithalakshan49  Have you tried like below and not invoking?

 

ublic class APReleaseProcess_Extension : PXGraphExtension<PX.Objects.AP.APReleaseProcess>
{
#region Event Handlers
public delegate List<APRegister> ReleaseDocProcDelegate(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs);
[PXOverride]
public List<APRegister> ReleaseDocProc(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs, ReleaseDocProcDelegate baseMethod)
{
var retVal = baseMethod(je,doc,isPrebooking,ref inDocs);
//Your code goes here.
PXTrace.WriteInformation("My override worked!");
return retVal;
}


#endregion
}

 

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • June 27, 2023

Hi @charithalakshan49  Have you tried like below and not invoking?

 

ublic class APReleaseProcess_Extension : PXGraphExtension<PX.Objects.AP.APReleaseProcess>
{
#region Event Handlers
public delegate List<APRegister> ReleaseDocProcDelegate(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs);
[PXOverride]
public List<APRegister> ReleaseDocProc(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs, ReleaseDocProcDelegate baseMethod)
{
var retVal = baseMethod(je,doc,isPrebooking,ref inDocs);
//Your code goes here.
PXTrace.WriteInformation("My override worked!");
return retVal;
}


#endregion
}

 


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • June 27, 2023

Hi @charithalakshan49 ,

You can try the below alternate approach also. Overriding the release button.
 

 public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
    {
        public static bool IsActive() => true;
      
        [PXUIField(DisplayName = "Release", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
        [PXProcessButton]
        [APMigrationModeDependentActionRestriction(
            restrictInMigrationMode: false,
            restrictForRegularDocumentInMigrationMode: true,
            restrictForUnreleasedMigratedDocumentInNormalMode: true)]
        public virtual IEnumerable Release(PXAdapter adapter)
        {
            PXCache cache = Base.Document.Cache;
            List<APRegister> list = new List<APRegister>();

            throw new PXException("Release Action");

            //return list;
        }
    }


Forum|alt.badge.img+1

@Naveen Boga  Yes it worked!. Thank you.

@jinin Thanks for the response. I tried that. But it didn’t work.