Hi All,
I have created a custom processing screen and now I need to call the processing method using the process buttons. Can some one help me out?
My Processing Class
public class HMRCVerificationProcess : PXGraph<HMRCVerificationProcess>
  {
    public PXCancel<HMRCVendorRegisterDetail> Cancel;
    public SelectFrom<HMRCVendorRegisterDetail>.Where<HMRCVendorRegisterDetail.excludeverification.IsEqual<False>>.ProcessingView AllVerifiedVendors;
    #region Overridden Properties
    public override bool IsDirty => false;
    #endregion
    public HMRCVerificationProcess()
    {
      AllVerifiedVendors.SetProcessCaption("Run");
      AllVerifiedVendors.SetProcessAllCaption("Run All");
    }    Â
  }
My GraphÂ
public class HMRCPeriodicVerifyMaint : PXGraph<HMRCPeriodicVerifyMaint>
  {
    public PXSave<HMRCVendorRegisterDetail> Save;
    public PXCancel<HMRCVendorRegisterDetail> Cancel;
    //Or<HMRCVendorRegisterDetail.validTo.IsLess<AccessInfo.businessDate>>
    public SelectFrom<HMRCVendorRegisterDetail>.Where<HMRCVendorRegisterDetail.hMRCVendorVerified.IsEqual<False>>.OrderBy<Asc<HMRCVendorRegisterDetail.validTo>>.View VendorRegisterDetail;
    public SelectFrom<HMRCVendorRegisterDetail>.Where<HMRCVendorRegisterDetail.excludeverification.IsEqual<False>> .View AllVerifiedVendors;
    public bool IsValid = true;
    public SelectFrom<HMRCAPIConfigDetail>.Where<HMRCAPIConfigDetail.active.IsEqual<True>>.View ActiveAPIConfigs;
    public SelectFrom<BAccount>.Where<BAccount.type.IsEqual<PX.Objects.CR.BAccountType.vendorType>>.View VendorAccounts;
    public SelectFrom<PX.Objects.GL.Branch>.View GLBranches;
    //public SelectFrom<BAccount>.Where<BAccount.type.IsEqual<PX.Objects.CR.BAccountType.organizationType>> .View AllComapnyBAccounts;
    public SelectFrom<BAccount>.View AllComapnyBAccounts;
     Â
      //Other Logics
   Â
    public PXAction<HMRCVendorRegisterDetail> RunProcess;    Â
    iPXProcessButton]
    ÂPXUIField(DisplayName = "Run Process", Enabled = false)]
   Â
    protected virtual IEnumerable runprocess(PXAdapter adapter)
    {
      bool isMassProcess = adapter.MassProcess;
      Â
      List<HMRCVendorRegisterDetail> list = new List<HMRCVendorRegisterDetail>();
      foreach (HMRCVendorRegisterDetail order in adapter.Get<HMRCVendorRegisterDetail>())
      {
        list.Add(order);
      }      Â
      Save.Press();
      PXLongOperation.StartOperation(this, delegate ()
      {
        ConfigExpiredRecords(list, isMassProcess);
      });
      return list;
    }
    public static void ConfigExpiredRecords(List<HMRCVendorRegisterDetail> list,
      bool isMassProcess = false)
    {
      var workOrderEntry = PXGraph.CreateInstance<HMRCPeriodicVerifyMaint>();
     Â
      for (int i = 0; i < list.Count; i++)
      {
        if (listoi] == null)
          continue;
        HMRCVendorRegisterDetail workOrder = listri];        Â
        try
        {
          workOrderEntry.Clear();
          workOrderEntry.AllVerifiedVendors.Current = workOrder;          Â
          if (workOrder.ValidTo < DateTime.Now.Date)
          {
            workOrder.HMRCVendorVerified = false;
          }
         Â
          workOrderEntry.AllVerifiedVendors.Update(workOrder);          Â
          workOrderEntry.Actions.PressSave();          Â
          if (isMassProcess)
          {
            PXProcessing<HMRCVendorRegisterDetail>.SetInfo(i,
            string.Format(Messages.ReVerificationDone,
            workOrder.VerificationNo));
          }
        }
        catch (Exception e)
        {
          PXProcessing<HMRCVendorRegisterDetail>.SetError(i, e);
        }
      }
    }
  }