Announcements
No record found.
I am working on a customization in Dynamics 365 Finance and Operations related to the transfer order shipping process. Specifically, I want to automatically set the "AutoReceive" checkbox to Yes when the "from" and "to" sites are the same, and to No when they are different.
I have implemented an event handler to achieve this within the standard InventTransferParmShip form. However, I am encountering an issue where no data is being loaded into the inventtransferparmtable or inventdim when I try to apply this logic. I am not very experienced in standard form customization any help will be appreciated. Environment: Dynamics 365 Finance & Operations
InventTransferParmShip
[ExtensionOf(formStr(InventTransferParmShip))] final class InventTransferParmShip_AcxJewellery_Extension { [formeventhandler(formstr(inventtransferparmship), formeventtype::Activated)] public static void inventtransferparmship_oninitialized(xformrun sender, formeventargs e) { formdatasource inventtransferparmtableds = sender.datasource(formdatasourcestr(inventtransferparmship, inventtransferparmtable)); formdatasource inventdimds = sender.datasource(formdatasourcestr(inventtransferparmship, inventdim)); inventtransferparmtable inventtransferparmtable = inventtransferparmtableds.cursor(); (no data) inventdim inventdim = inventdimds.cursor(); (no data) if (inventdim) { inventlocation inventlocation; inventsiteid locationsiteid = ""; select firstonly inventlocation where inventlocation.inventlocationid == inventdim.inventlocationid; if (inventlocation) { locationsiteid = inventlocation.inventsiteid; } inventsiteid sitesiteid = inventdim.inventsiteid; if (locationsiteid == sitesiteid && locationsiteid != "") { inventtransferparmtable.autoreceiveqty = noyes::yes; } else { inventtransferparmtable.autoreceiveqty = noyes::no; } inventtransferparmtableds.reread(); inventtransferparmtableds.refresh(); } } }
From
To
SiteId
AutoReceive
AutoReceiveQty
final class InventTransferParmShip_Extension { int active() { int ret; ret = next active(); if(ret) { InventTransferParmTable inventTransferParmTable = this.cursor(); InventTransferTable inventTransferTable; str Transfer; Transfer = inventTransferParmTable.TransferId; if (Transfer) { select firstOnly inventTransferTable where inventTransferTable.TransferId ==Transfer; if (inventTransferTable) { InventLocation inventLocationFrom = InventLocation::find(inventTransferTable.InventLocationIdFrom); if (inventLocationFrom.InventSiteId == inventTransferTable.InventLocationIdTo) { inventTransferParmTable.AutoReceiveQty = NoYes::Yes; } else { inventTransferParmTable.AutoReceiveQty = NoYes::No; } inventTransferParmTable.reread(); } } } return ret; } }
Hi Martin,
Thank you for your feedback.
Regarding the first issue, I have since corrected the code by retrieving the To site ID, so it is now functioning properly at the very least.
Initially, the code was working fine based on my requirements, but as you pointed out, there were some flaws, which I have rolled back for now.
To clarify my current requirement, I need a solution to mark all transfer orders as Received for those that are shipped and have the same site ID. Do you think it would be possible to achieve this through a batch job? Ideally, this batch job would fetch all relevant transfer orders and mark them as received on a scheduled basis. and thats why i also tried to implement that autoreceive button to enable with these condition while shipping.
I would appreciate any suggestions or insights on how to best implement this.
Thanks again for your help! Ayushaman
[ExtensionOf(classStr(InventTransferMulti))] public final class InventTransferMulti_Extension { protected void updateInventTransferParmTable(InventTransferParmTable _inventTransferParmTable, InventTransferTable _inventTransferTable) { next updateInventTransferParmTable(_inventTransferParmTable, _inventTransferTable); if (!_inventTransferTable) { _inventTransferTable = InventTransferTable::find(_inventTransferParmTable.TransferId); if (!_inventTransferTable) { throw error(strFmt("InventTransferTable record not found for TransferId: %1", _inventTransferParmTable.TransferId)); } } if (_inventTransferTable.TransferStatus == InventTransferStatus::Shipped) { InventLocation inventLocationFrom = InventLocation::find(_inventTransferTable.InventLocationIdFrom); InventLocation inventLocationTo = InventLocation::find(_inventTransferTable.InventLocationIdTo); if (inventLocationFrom.InventSiteId == inventLocationTo.InventSiteId && !_inventTransferParmTable.AutoReceiveQty) { select forUpdate _inventTransferParmTable where _inventTransferParmTable.TransferId == _inventTransferParmTable.TransferId; ttsBegin; _inventTransferParmTable.AutoReceiveQty = true; _inventTransferParmTable.update(); ttsCommit; } } } }
select forUpdate _inventTransferParmTable where _inventTransferParmTable.TransferId == _inventTransferParmTable.TransferId;
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 662 Super User 2026 Season 1
Giorgio Bonacorsi 660
Subra 489