如何重定向到仪表板并传递参数值

时间:2018-12-18 21:30:23

标签: acumatica acumatica-kb

是否可以重定向到仪表板屏幕并在Acumatica上传递仪表板参数值?例如,Acumatica上的Customer View Dashboard具有一个参数(请参见下文),我想使用param值重定向到此屏幕。

enter image description here

1 个答案:

答案 0 :(得分:0)

为了使用参数值重定向到“仪表板”屏幕,您可以使用“仪表板”屏幕的图形并将参数传递到图形的“过滤器数据”视图。 然后可以使用Url和graph(dashboard)引发PXRedirectRequiredException。

请参见下面的代码段

public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
    #region Event Handlers

    public PXAction<PX.Objects.AR.Customer> Test;

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "test")]
    protected void test()
    {
        Customer customer = Base.BAccount.Current;
        if (customer != null)
        {
            string screenID = "DB000031";

            PXSiteMapNode sm = GIScreenHelper.GetSiteMapNode(screenID);
            PXGraph graph = GIScreenHelper.InstantiateGraph(screenID);

            if (graph is LayoutMaint)
            {
                LayoutMaint copygraph = graph as LayoutMaint;

                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters["CustomerAccountID"] = customer.AcctCD;

                copygraph.Filter.Current.Values = parameters;
                throw new PXRedirectRequiredException(sm.Url, copygraph, PXBaseRedirectException.WindowMode.New, String.Empty);
            }
        }
    }
    #endregion
}

参见下文:

enter image description here

使用参数重定向:

enter image description here