在创建新供应商或更新现有供应商时更新供应商 Class

Update Vendor Class while creating new or updating existing Vendor

我正在尝试更新供应商 Class,同时使用代码创建新供应商或更新现有供应商。但是,我遇到了以下错误--

"Error: An error occurred while processing the field Class ID value SERVICES Error: Class ID 'SERVICES' cannot be found in the system.."

下面是代码片段

VendorR row1 = null;
VendorMaint graph = PXGraph.CreateInstance<VendorMaint>();

row1 = new VendorR();

row1 = graph.BAccount.Insert(row1);

row1.VendorClassID = "SERVICES";

graph.BAccount.Update(row1);

考虑文件 "Your_Acumatica_Installation"\App_Data\CodeRepository\PX.Objects\AP\DAC\Vendor.cs" 在 VendorClassID 附近你可以找到声明,它说它只能有来自 VendorClass table 的值,字段 vendorClassID。我的意思是(Search2)。我假设 table 中没有任何字段,等于 "SERVICES"

是的,它肯定与 VendorClass 相关,并且只有那些值显示在查找中。但是,要更新 VendorClass,只需几步即可完成更新。

我找到了答案。我从 VendorMaint class 调用了 CopyAccounts 方法,它会根据需要更新 VendorClass 以及几个相关字段。我已经对其进行了测试,它正在正确更新 VendorClass。

谢谢。 克鲁纳尔