Hi all,
Running AX2012 R3 CU10 and I'm having a bit of an issue.
Currently, I'm running a display method on a form which uses InventTransOrigin.ReferenceId to pull info on the original purchase order of a stock transaction. However, this isn't ideal because ReferenceId will change to the most recent stock transfer journal if we move stock around. I can't see another way of linking it to the purchase order.
I'm trying to think of the most frictionless way of solving my issue. Is there a way when the InventTrans or InventTransOrigin record is created, I can capture the RecId of the PurchLine record it originally referred to, or even the purchase order number? I can't see where ReferenceId is originally set in any init()-type functions on either of these tables. Alternately, is there somewhere else where this link is stored that I'm missing?
Thanks very much in advance,
Luke
*This post is locked for comments
Ahh, thank you very much! :D This has made my job a lot easier
You are wrong, the relation is there:
Hi, InventTransId won't link to my purchase line which is where the information I need to display is - unless I am wrong? Is there a way to do this?
You cant keep the referenceId because this is changing everytime, And you cant update the table or get the purchId.
you can use the inventTransId value to do the relation in your display.
that the best way use the invetTransId.
Hi
Ahh, I thought that maybe but I was sure transRefId referred to a field within InventTrans. Would I be able to manually set a value on the new inventTransOriginId object?
If so, could I do this just through basic variable set InventTransOriginId.ReferenceId = ___ or would I need to do forUpdate SQL?
Thanks very much
You can see here:
if (!inventTransOriginId)
{
itemInventDim = movement.inventdim().data();
itemInventDim.clearNotProductDim(movement.inventDimGroupSetup());
inventTransOriginId = InventTransOrigin::create(
movement.transId(),
movement.itemId(),
movement.transType(),
movement.transRefId(),
movement.dirParty(),
InventDim::findOrCreate(itemInventDim).InventDimId).RecId;
movement.inventTransOriginId(inventTransOriginId);
movement.createOriginOwnerRelationship();
}
The movement.TransRefId is the number that are you looking for?
Hi,
That seems along the right lines! However, I can't seem to see the code set ReferenceId, this would probably be where I would insert it?
Pls advise, thanks
You can check the Class\InventUpdate\CreateInventTransOriginAndReferences.
Tell me if that works for you, if not I can search more for you.
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
48
Zain Mehmood
6
Moderator