将数据保存到其他公司 [英] Save data to different company

查看:33
本文介绍了将数据保存到其他公司的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有代码在Acumatica BLC中使用Acumatica Web服务,因为我们想将数据保存到其他公司。使我知道了不使用Web服务的另一种方式-例如公司上下文之类的东西,但是我找不到对此的任何引用。

We've got code to use the Acumatica Web Services inside of an Acumatica BLC, because we want to save data to a different company. I was made aware of another way to do this without using the Web Services - something such as a 'company context' or the like, but I'm not able to find any references to this.

是否有一个现有示例来创建具有不同公司上下文的屏幕图形,以便将数据保存到该公司?

Is there an existing example to create a graph of a screen with a different company context in order to save data to that company?

推荐答案

要将数据保存到其他公司,应在PXLoginScope中执行代码。在下面的示例中,新库存项目保存在 NewCompany 租户下:

To save data to a different company, you should execute your code within PXLoginScope. In the sample below new Stock Item is saved under the NewCompany tenant:

using (PXLoginScope ls = new PXLoginScope("admin@NewCompany"))
{
    InventoryItemMaint maint = PXGraph.CreateInstance<InventoryItemMaint>();
    InventoryItem item = new InventoryItem();
    item.InventoryCD = "TEST";
    item = maint.Item.Insert(item);
    item.ItemClassID = "ALLOTHER";
    maint.Item.Update(item);
    maint.Actions.PressSave();
}

这篇关于将数据保存到其他公司的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆