to fix reserved item in D365 FO x++ (Recalculate Inventory)

i mistakenly delete some SO line from sales order through SSMS but lines item are reserved .

now what happened they do not going to unreserve 

what i did is to delete related record from inventTrans and inventtransOrigin 
than run the script below to fix it.
Now it works.

 

static void InventSum_Recalculate(Args _args)  

 {  
InventSumRecalcItem InventSumRecalcItem;
InventTable _InventTable;
while select * from _InventTable where _InventTable.ItemId == 'DPID0000040'
{
ttsBegin;
InventSumRecalcItem = new InventSumRecalcItem(_InventTable.ItemId, true, checkfix::fix);
InventSumRecalcItem.updatenow();
ttsCommit;
}
info("Done");
}

Comments

Popular posts from this blog

step 20 Update script for service model: AOSService on machine: CR-VM-Test-1

How to Bypass Next in COC in D365 X++