Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Acumatica 既然GIScreenHelper被标记为过时,如何重定向到仪表板?_Acumatica - Fatal编程技术网

Acumatica 既然GIScreenHelper被标记为过时,如何重定向到仪表板?

Acumatica 既然GIScreenHelper被标记为过时,如何重定向到仪表板?,acumatica,Acumatica,我们有一个仪表板,可通过库存项目页面上的查询菜单访问。在2019 R2最近一次小升级之前,以下代码编译时没有问题,以允许打开与当前库存ID相关的仪表板。它仍然编译,但警告GIScreenHelper已过时,将在下一次升级中标记为内部。因此我的问题是。。。如果无法使用GIScreenHelper初始化PXRedirectRequiredException中使用的图形,如何重定向到仪表板 string screenID = "SS0010DB"; //DashboardID PXSiteMapNo

我们有一个仪表板,可通过库存项目页面上的查询菜单访问。在2019 R2最近一次小升级之前,以下代码编译时没有问题,以允许打开与当前库存ID相关的仪表板。它仍然编译,但警告GIScreenHelper已过时,将在下一次升级中标记为内部。因此我的问题是。。。如果无法使用GIScreenHelper初始化PXRedirectRequiredException中使用的图形,如何重定向到仪表板

string screenID = "SS0010DB"; //DashboardID 
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["InventoryID"] = item.InventoryCD;
    copygraph.Filter.Current.Values = parameters;

    throw new PXRedirectRequiredException(sm.Url, copygraph, PXBaseRedirectException.WindowMode.New, string.Empty);
}
string screenID=“SS0010DB”//仪表板ID
PXSiteMapNode sm=GIScreenHelper.GetSiteMapNode(屏幕ID);
PXGraph-graph=GIScreenHelper.instancegraph(屏幕ID);
if(图为LayoutMaint)
{
LayoutMaint copygraph=作为LayoutMaint的图形;
字典参数=新字典();
参数[“InventoryID”]=item.InventoryCD;
copygraph.Filter.Current.Values=参数;
抛出新的PXRedirectRequiredException(sm.Url、copygraph、PXBaseRedirectException.WindowMode.new、string.Empty);
}

我已尝试直接初始化LayoutMaint,但我不知道如何设置以指定要使用的屏幕ID和传递参数。

我猜您在这里有两个选项:

  • 创建
    DashboardMaint
    graph实例,它是仪表板页面图形,提供仪表板的名称并调用该图形的
    viewDashboard
    操作

  • 只需获取DashboardMaint的
    viewDashboard
    操作的代码,并直接重定向到您的仪表板:

    [PXButton(ConfirmationType = PXConfirmationType.IfDirty, ConfirmationMessage = "Any unsaved changes will be discarded. Do you want to proceed?")]
    [PXUIField(DisplayName = "View")]
    public void viewDashboard()
    {
        throw new PXRedirectToUrlException(PXSiteMap.Provider.FindSiteMapNodeByScreenID(this.Dashboards.Current.ScreenID).Url, PXBaseRedirectException.WindowMode.Same, "View Dashboard");
    }
    
  • 已更新

    下面是一个代码示例,说明如何使用过滤器的预定义值打开仪表板。 该示例是为客户视图仪表板编写的

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "CustomerView")]
    protected virtual IEnumerable RedirectToCustomerViewDashboard(PXAdapter adapter)
    {
        string screenID = "DB000031"; //DashboardID 
        LayoutMaint graph;
        using (new PXScreenIDScope(screenID))
        {
            graph = PXGraph.CreateInstance<LayoutMaint>(screenID);
        }
        Dictionary<string, object> parameters = new Dictionary<string, object>();
        parameters["CustomerAccountID"] = "ABARTENDE";
        graph.Filter.Current.Values = parameters;
        throw new PXRedirectRequiredException(PXSiteMap.Provider.FindSiteMapNodeByScreenID(screenID).Url, graph, PXBaseRedirectException.WindowMode.New, string.Empty);
    }
    
    [PXButton(CommitChanges=true)]
    [PXUIField(DisplayName=“CustomerView”)]
    受保护的虚拟IEnumerable重定向到CustomerViewDashboard(PXAdapter适配器)
    {
    string screenID=“DB000031”;//仪表板ID
    布局维护图;
    使用(新PXScreenIDScope(screenID))
    {
    graph=PXGraph.CreateInstance(screenID);
    }
    字典参数=新字典();
    参数[“CustomerAccountID”]=“ABARTENDE”;
    graph.Filter.Current.Values=参数;
    抛出新的PXRedirectRequiredException(PXSiteMap.Provider.FindItemsApodeByScreenId.Url,图形,PXBaseRedirectException.WindowMode.new,string.Empty);
    }
    
    该值的键是仪表板定义中参数的名称


    谢谢您的回复。今天早上我在尝试你的建议,但我不知道在哪里给出参数。我也可以通过屏幕ID的URL直接进入仪表板屏幕,它不像LayoutMaint那样接受参数。当我在屏幕中提供一个InventoryID作为参数时,它将缩小到我的项目,但我需要将用户带到已经填写了InventoryID的仪表板。只需转到仪表板即可返回所有项目的数据。关于包含参数的任何指导?您将页面id传递给PXSiteMap.Provider.findsitemsapnodebyscreenidunsecurefindsitemsapnodebyscreenidunsecure似乎未公开。尽管如此,我可以用各种方法打开仪表板,但我无法让它接受输入参数。我甚至尝试抛出新的PXRedirectTourexception(url,PXBaseRedirectException.WindowMode.NewWindow,“,参数);其中参数是“InventoryID”和my InventoryCD值的字典对,但它不填充为仪表板定义的InventoryID筛选器参数。@BrianStevens不幸的是,这些
    参数
    用于前面的
    字符串
    ,而不用于图形。我正在检查是否有其他方法可以做到这一点。感谢更新和代码示例。它工作得很好。答案更新了。