How can I Move Site And warehouse in moment trans from movement header

Hi,

I have a requirement where I need to pass the value of Site And Warehouse from Movement header to movement trans.

Header have InventLocation and InventSite Fields where as trans have InventDimId only. Now I am getting invent dim id by the combination and passing it in to “InventJournalTransData” class’s “initFromJournalTable” method.

but the values are still coming blank.

This is updating site and warehouse from purch table header to lines. See how it is done in ,
\Classes\PurchLineType\initFromPurchTable

We have almost same method in InventJournalTrans. I amd using the same but still not getting record in Lines.

Check if it being overwritten in initFromInventTable

Values are getting in method but still not coming in form .

Here what we wrote in “InitFromInventJournalTable”…

inventJournalTrans.ISY_InventSiteId = inventJournalTable.InventSiteId;
isy_InventDim = inventJournalTrans.inventDim();
if (inventJournalTable.InventLocationId || inventJournalTable.InventSiteId)
{
isy_InventDim.InventLocationId = inventJournalTable.InventLocationId;
isy_InventDim.InventSiteId = inventJournalTable.InventSiteId;
}

inventJournalTrans.setInventDimIdFromInventDim(isy_InventDim);

Have you checked \Data Dictionary\Tables\InventJournalTrans\Methods\initFromInventTable?

initFromInventJournalTable & initFromInventJournalTrans bith are not getting called .

I put the code in both but not working.

so you haven’t checked initFromInventTable. (there is a code here that sets invent dimensions from item)
You need to start looking at \Classes\InventJournalFormTrans_Movement\fieldModifiedItemIdPost

I checked it and put my code after this method call (Modification in ItemId )… For Testing purpose I put manual InventDimId manually but still blank records.

Where did you put the code? Can you show it?

In “\Forms\InventJournalMovement\Data Sources\InventJournalTrans\Fields\ItemId”

for testing purpose I put hardcore value.

void modified()
{
super();

journalFormTrans.fieldModifiedItemIdPost();
//
journalFormTrans.journalTable();
if (exciseEnabled)
{
inventJournalTrans.initCompanyLocation_IN();
inventJournalTransTaxExtensionIN.TaxInformation_IN = TaxInformation_IN::findDefaultbyLocation(inventJournalTrans.WarehouseLocation_IN).RecId;
inventJournalTransTaxExtensionIN_DS.object(fieldNum(InventJournalTransTaxExtensionIN, TaxInformation_IN)).modified();

inventJournalTrans.SalesPurchJournalLineExtension_IN::initFromPrimaryTable(inventJournalTrans);

element.enableFieldsActive_IN();
inventJournalTrans_DS.refresh();
}
// inventJournalTrans.initSiteInventory(journalFormTrans.journalTable());
inventJournalTrans.InventDimId = ‘000101’;

//
}

Place your code in \Classes\InventJournalFormTrans_Movement\fieldModifiedItemIdPost,
Example,
InventJournalTable inventJournalTableLoc;
inventJournalTableLoc = inventJournalTrans.inventJournalTable();

inventDim.InventSiteId = inventJournalTableLoc.InventSiteId;
inventDim.InventLocationId = inventJournalTableLoc.InventLocationId;
inventJournalTrans.setInventDimIdFromInventDim(inventDim);

Kranti,

I found one thing,

We are getting value from “initFromJournalTable” method of “InventJournalTransData” class. but it’s not showing us data before saving our record.

As site is a manadetory field in Line form in Inventory Dimension tab so we are not able to save data.

Now we have two solution first - we could fill data before saving the record or second - We could remove mandatory field in inventory dimension tab.

As we are wrking on first part but not getting it so can we make inventory Dimension non mandatory

Not a an option.

Have you tried the code that i have shown in my previous reply?

I am trying it

Yes it’s working fine Thanks a ton…

But I think we were trying same logic under item Modification there it should be work.

Not setting the inventDim values.