如何通过Acumatica Web Service修改客户ID

本文关键字:修改 客户 ID Service Web 何通过 Acumatica | 更新日期: 2023-09-27 17:49:54

如何通过Acumatica Web Service更改CustomerID我有这个代码,但没有工作

            LoginResult loginResult = context.Login("admin", "123");
            Content AR303000 = context.GetSchema();
            context.Clear();
            context.SetSchema(AR303000);
            var commands = new List<Command>();
            //AR303000.CustomerSummary.CustomerID.LinkedCommand = null;
            commands.Add(new Value { Value = "ABARTENDE", LinkedCommand = AR303000.CustomerSummary.CustomerID });
            commands.Add(AR303000.Actions.ChangeID);
            commands.Add(new Value { Value = "ABARTENDE1", LinkedCommand = AR303000.SpecifyNewID.CustomerID });
            commands.Add(new Value { Value = "OK", LinkedCommand = AR303000.SpecifyNewID.ServiceCommands.DialogAnswer }); //---> I tried this line nothing works
            commands.Add(AR303000.Actions.Save);
            var result = context.Submit(commands.ToArray());

如何通过Acumatica Web Service修改客户ID

您需要稍微不同的命令顺序,并在几个地方设置Commit标志以使其工作:

AR303000.Actions.ChangeID.Commit = true;
commands.Add(new Value { Value = "ABARTENDE", LinkedCommand = AR303000.CustomerSummary.CustomerID, Commit = true });
commands.Add(new Value { Value = "ABARTENDE1", LinkedCommand = AR303000.SpecifyNewID.CustomerID });
commands.Add(new Value { Value = "OK", LinkedCommand = AR303000.SpecifyNewID.ServiceCommands.DialogAnswer, Commit = true });
commands.Add(AR303000.Actions.ChangeID);
commands.Add(AR303000.Actions.Save);

我不完全理解为什么ChangeID和DialogAnswer命令上需要提交标志,但是这个信息直接来自Acumatica平台的创建者。