In class InventTransferUpdReceive, method: UpdateInventTransferLine I initiate my custom class. I assigned values to the assessor methods (parm methods).
Then in class InventMovement, method UpdateLedgerAdjust I need to call a method on my custom class. I cannot in here use CustomClass A = new CustomClass() because then it is a new instance and all parm-methods will be empty.
InventTransferUpdReceive.UpdateInventTransferLine calls InventUpd_Financial at one point, wich calls inventUpd_financial.UpdatefinancialIssue which will call movement.UpdateLedgerAdjust.
I cannot pass my custom class as an argument down the line because it is the InventMovement class which is called everywhere in AX. So it is safer to create a parm-method on InventMovement and when it is initiated in InventTransferUpdReceive.UpdateInventTransferLine, to set the instance of my custom class in the parm-method.
In InventTransferUpdReceive.UpdateInventTransferLine, InventMovement is initiated as follow:
movementTo = InventMovement::construct(inventTransferLine,InventMovSubType::TransferOrderTo);
At the top of this method I added the initiation of my custom class.
customClass A = new customClass();
Below the initiation of InventMovement I add code to assign values to parm-methods on my custom class. I also add this code to set the instance of my custom class on InventMovement:
movementTo.parmCustomClass(A);
in InventMovement I have in the classDeclaration:
customClass AA;
The parm-method I created:
public customClass parmClass (customClass _class = AA)
{
AA = _class;
return AA;
}
I added a breakpoint to this method and the moment it hits AA = _class, it gives me the following error:
Error executing code: Wrong argument types in variable assignment.
I made sure that the custom class name is spelled correctly, so it is not a misspelling.
Does it not like a class to be a parameter or what am I doing wrong here.
Any help is appreciated.