将记录复制到acumatica中的另一个屏幕

Copy Records to another Screen in acumatica

我有2个屏幕,查询和数据输入。 我想将记录从屏幕 1 复制到屏幕 2,请参见下图。 scree1 and Screen2

我使用以下代码:

public PXAction<FuncLocFilter> CreateFuncLoc;
    [PXButton]
    [PXUIField(DisplayName = "Create Functional Location")]
    protected virtual void createFuncLoc()
    {
        FuncLocFilter row = Filter.Current;
        BSMTFuncLoc FnLc = new BSMTFuncLoc();

        FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();
        graph.FunLocations.Current.FuncLocCD = row.FuncLocCD;
        graph.FunLocations.Current.StructureID = row.StructureID;
        graph.FunLocations.Current.HierLevels = row.HierLevels;
        graph.FunLocations.Current.EditMask = row.EditMask;
        if (graph.FunLocations.Current != null)
        {
            throw new PXRedirectRequiredException(graph, true, "Functional Location");
        }
    }

但我遇到了如下错误: Error

有人可以帮忙解决这个看似愚蠢的问题吗?

对不起我的英语不好..:)

谢谢!

以下是在 Acumatica

中通过 code/programming 创建数据记录的常用模式
    public PXAction<FuncLocFilter> CreateFuncLoc;
    [PXButton]
    [PXUIField(DisplayName = "Create Functional Location")]
    protected virtual void createFuncLoc()
    {
        FuncLocFilter row = Filter.Current;

        // 1. Create an instance of the BLC (graph)
        FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();

        // 2. Create an instance of the BSMTFuncLoc DAC, set key field values (besides the ones whose values are generated by the system), 
        //    and insert the record into the cache
        BSMTFuncLoc FnLc = new BSMTFuncLoc();
        FnLc.FuncLocCD = row.FuncLocCD;
        FnLc = graph.FunLocations.Insert(FnLc);

        // 3. Set non-key field values and update the record in the cache
        FnLc.StructureID = row.StructureID;
        FnLc.HierLevels = row.HierLevels;
        FnLc.EditMask = row.EditMask;
        FnLc = graph.FunLocations.Update(FnLc);

        // 4. Redirect
        if (graph.FunLocations.Current != null)
        {
            throw new PXRedirectRequiredException(graph, true, "Functional Location");
        }