InvetMarking return cost amount to Invent Journal Transaction

Hi I’m modifying the InventMarking form in AX 2009 to return the cost amount of the marked Itemto the Movement Journal Line Item Cost. The problem is I still do not know how to call the form who called the InventMarking.

hi Ian Dexter

it seem in sales order form if sales line items are more than 1 record you can mark them.

see this pic to Understand subject

jalal

YES we coul mark them but what I need is when I mark the item its cost price on the marked transaction will appear on the form who called it.

It took me sometime to solve my problem but its worth it. :smiley:

I’ve edited the updateMarking() function on InventMarking

here goes:

void updateMarking()
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;

if (inventTrans.InventTransId && mapMarkNow && mapMarkNow.elements())
{
TmpInventTransMark::updateTmpMark(inventTrans.InventTransId,inventDim,inventTrans.Qty,mapMarkNow.pack());

if (inventTrans.TransType == inventTranstype::InventTransaction)
{
Select firstonly inventJournalTable where inventJournalTable.JournalId == inventTrans.TransRefId ;
// info(inventJournalTable.JournalId);

if (inventJournalTable.JournalType == InventJournalType::Movement) {

ttsbegin;
Select forupdate firstonly inventJournalTrans where inventJournalTrans.ItemId == inventTrans.ItemId
&& inventJournalTrans.InventTransId == inventTrans.InventTransId;

inventJournalTrans.CostAmount = TmpInventTransMark.costPrice() * TmpInventTransMark.qtyMarkNow * (-1) ;
inventJournalTrans.CostPrice = TmpInventTransMark.costPrice();
inventJournalTrans.update(NoYes::Yes);
// info(num2str((TmpInventTransMark.costPrice()),6,2,1,1));
ttscommit;

}

}

element.refreshCaller();

}

element.clearMarkNow();

}