web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to use Accessor (parm) methods?

(0) ShareShare
ReportReport
Posted on by 2,892

Hi, I'm trying to use Parm methods to store a variable in a method in class A, and I want to get that value in a method in class B, however, when I try to get the value, it comes empty, I'm not really familiar with Parm methods, could you help me out? this is what I have right now:

public InventTransferId parmInventTransferId(InventTransferId _inventTransferId = inventTransferId)
{
inventTransferId = _inventTransferId;

return inventTransferId;
}

I use parmInventTransferId("value") in class A, and I try to get the value back in class B by using inventParmInventTransferId() but I get nothing, I set the parm method in the class where I'm trying to receive the value, and also in a separated class, but the result is the same, could you help me out please? thanks!!

 

*This post is locked for comments

I have the same question (0)
  • dolee Profile Picture
    11,279 on at
    RE: How to use Accessor (parm) methods?

    Hi,

    Yes, your finding is correct. If you assigned a value to instance A of WMSShipmentReservation, the value only exists in instance A.

    Have you found out why is there another instance of WMSShipmentReservation?

  • saman0suke Profile Picture
    2,892 on at
    RE: How to use Accessor (parm) methods?

    Ok, I got what the problem is, after my instantiation of the class that contains the parm method, there is another instance that makes my value to get lost, I could use that instance, however, at that point the value that I need is no longer available, is there any other way to do this?

  • saman0suke Profile Picture
    2,892 on at
    RE: How to use Accessor (parm) methods?

    I'm using two existing classes, abstract class InventTransferUpd extendas UpdateBase, this is the one where I create a new instance of the class WMSShipmentReservation, where I have the parm method declared, something like this:

    WMSShipmentReservation wmsShipReservation = new WMSShipmentReservation();

    wmsShipReservation.parmInventTransferId("value");

    WMSShipmentReservation extends RunBase, I call the parm method like this:

    str value = this.parmInventTransferId();

    But I get nothing, I see that in WMSShipmentReservation class there are two methods, pack and unpack:

    public container  pack()

    {

       return conNull();

    }

    public boolean  unpack(container  packedClass)

    {

       return true;

    }

    Thanks in advanced!

  • PA-22040759-0 Profile Picture
    6,194 on at
    RE: How to use Accessor (parm) methods?

    As a short answer to how the parm methods are used, I'd like to add the following.

    classB.parmInventTransferId('Value') works like a normal Setter.

    classB.parmInventTransferId() works like a normal Getter.

    As Tommy suggests you may be missing packing/unpacking if one of your classes is a RunBase class. It would be beneficial if we could get to see more of your code.

  • Suggested answer
    Tommy Skaue Profile Picture
    Moderator on at
    RE: How to use Accessor (parm) methods?

    Have you implemented the pack-unpack pattern?

    msdn.microsoft.com/.../aa879675.aspx

  • Suggested answer
    Rachit Profile Picture
    4,015 User Group Leader on at
    RE: How to use Accessor (parm) methods?

    Probably the instance of classA which calls the parmInventTransferId("value") is different from the instance of ClassA which you are calling from ClassB to get the value .

    If the instance is same you will get the value.

    Thanks,

    Rachit Garg

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans