ChangeCompany and table buffers
InventItemGroup inventItemGroup;
changeCompany ('A')
{
inventItemGroup.ItemGroupId = 'IA';
inventItemGroup.insert();
}
changeCompany ('B')
{
inventItemGroup = null;
inventItemGroup.ItemGroupId = 'IB';
inventItemGroup.insert();
}
Without inventItemGroup = null; line the second insert will throw an error:
Cannot create a record in Item groups (InventItemGroup).
Insert operations are not allowed across companies. Please use changecompany keyword to change the current company before inserting the record.
Because buffer still has dataAreaId value equals to 'A' and neither changeCompany nor insert does the substitution automatically.
So you need to either avoid using the same buffer in different companies or do not forget to reset it via assigning null value.
与本文相关的文章
- 更新后 Dynamics 365 财务和运营字段丢失 / Dynamics 365 Finance and Operations field missing after update
- D365商业对 Adyen支付和服务连接器的考虑进行修改 / D365 Commerce making changes to Adyen payment and service connector considerations
- Solved: D365 Fields automatically populating on form errantly – Due to a Chrome addin/已解决:D365 字段自动错误地填充到表单上——由 Chrome 插件引发
- D365全屏模式,适用于现代POS(MPOS)/ D365 Full screen mode for Modern POS (MPOS)
- Dynamics 365 / AX 2012 现代/企业版POS’速度扫描’功能 / Dynamics 365/AX 2012 Modern/Enterprise POS ‘Speed Scanning’ feature
- Microsoft 365、Dynamics 365、Office 365 品牌和术语 / Microsoft 365 vs Dynamics 365 vs Office 365 terminology and branding (hopefully) explained