Search code examples
erpacumatica

Open specified report and page in Acumatica


In Acumatica there is exception PXRedirectRequiredException which allows to redirect to another page in Acumatica. Is there a posibility to open report and application page?


Solution

  • You can use PXRedirectWithReportException. Here is code example of AssetMaint:

        AssetTranRelease graph = CreateInstance<AssetTranRelease>();
        AssetTranRelease.ReleaseFilter filter = (AssetTranRelease.ReleaseFilter)         
        graph.Filter.Cache.CreateCopy(graph.Filter.Current);
        filter.Origin = FARegister.origin.Disposal;
        graph.Filter.Update(filter);
        graph.SelectTimeStamp();
        int i = 0;
        Dictionary<string, string> parameters = new Dictionary<string, string>();
              foreach (FARegister register in created)
              {
                 register.Selected = true;
                 graph.FADocumentList.Update(register);
                 graph.FADocumentList.Cache.SetStatus(register, 
                 PXEntryStatus.Updated);
                        graph.FADocumentList.Cache.IsDirty = false;
                        parameters["FARegister.RefNbr" + i] = register.RefNbr;
                        i++;
                    }
    
                    parameters["DateFrom"] = null;
                    parameters["DateTo"] = null;
    
                    PXReportRequiredException reportex = new 
                    PXReportRequiredException(parameters, "FA680010", "Preview");
                    throw new PXRedirectWithReportException(graph, reportex, 
                                  "Release FA Transaction");