客户操作 "Extend To Vendor"

Customer Action "Extend To Vendor"

使用最新版本的 Acumatica 5 和最新最好的更新,我 运行 遇到了一个我无法解决的 Web API 问题。我有在客户屏幕上执行“扩展到供应商”操作的代码。它似乎 运行 很好并且不会出错但是它无法创建供应商。在我看来,当通过网站界面执行相同的操作时,问题是我没有发送正确的命令来选择弹出警告框“请确认是否要更新当前供应商设置”上的“是”按钮使用供应商 Class 默认值。否则将保留原始设置。”不过我可能完全不在,任何帮助将不胜感激。

这是我的代码:

String customerId = "SomeCustomerId";
String vendorClass = “SomeVendorClass”;

AcumaticaApiWS.AR303000Content AR303000 = context.AR303000GetSchema();
AcumaticaApiWS.AP303000Content AP303000 = context.AP303000GetSchema();

context.AR303000Clear();
AR303000.Actions.ExtendToVendor.Commit = true;

AcumaticaApiWS.AR303000Content[] AR303000result = context.AR303000Submit
(
    new AcumaticaApiWS.Command[]
    {
        new AcumaticaApiWS.Value { Value = customerId, LinkedCommand = AR303000.CustomerSummary.CustomerID },
        AR303000.Actions.ExtendToVendor
    }   
);

AcumaticaApiWS.AP303000Content[] AP303000result = context.AP303000Submit
(
    new AcumaticaApiWS.Command[]
    {
        new AcumaticaApiWS.Value { Value = vendorClass, LinkedCommand = AP303000.GeneralInfoFinancialSettings.VendorClass },
        new AcumaticaApiWS.Value { Value = "YES", LinkedCommand = AP303000.GeneralInfoFinancialSettings.ServiceCommands.DialogAnswer, Commit = true },
        AP303000.Actions.Save
    }
);

谢谢!

你快到了。这不是一个简单的场景,因为它涉及多个屏幕和对话框,这两件事使用起来并不简单。您的代码示例中的问题是:

  • 必须在 值之前 设置对话答案。在您的情况下,您首先要设置供应商 class。这是 counter-intuitive 但系统必须在显示对话框之前知道它
  • 对话答案是 "Yes",而不是 "YES"。您可以使用 Web 浏览器检查器 window 并查看按钮标题来查看。由于 CSS 样式,文本以大写形式显示。
  • 您需要在显示对话框的表单主视图 (AP303000.VendorSummary.ServiceCommands.DialogAnswer) 上设置对话框答案。如果不查看源代码就无法知道这一点,但我相信对话框通常都是这种情况。
  • 不需要不同的 Commit = true 设置(但在这种情况下不会造成伤害)。

这是我使用的代码,在我的例子中,它将客户扩展到供应商并同时更改供应商 class:

String customerId = "ACTIVESTAF";
String vendorClass = "DATACENTER";

AcumaticaApiWS.AR303000Content AR303000 = context.AR303000GetSchema();
AcumaticaApiWS.AP303000Content AP303000 = context.AP303000GetSchema();

context.AR303000Clear();

AcumaticaApiWS.AR303000Content[] AR303000result = context.AR303000Submit
(
    new AcumaticaApiWS.Command[]
    {
        new AcumaticaApiWS.Value { Value = customerId, LinkedCommand = AR303000.CustomerSummary.CustomerID },
        AR303000.Actions.ExtendToVendor
    }
);

AcumaticaApiWS.AP303000Content[] AP303000result = context.AP303000Submit
(
    new AcumaticaApiWS.Command[]
    {
        new AcumaticaApiWS.Value { Value = "Yes", LinkedCommand = AP303000.VendorSummary.ServiceCommands.DialogAnswer },
        new AcumaticaApiWS.Value { Value = vendorClass, LinkedCommand = AP303000.GeneralInfoFinancialSettings.VendorClass },
        AP303000.Actions.Save
    }
);