Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to use Accessor (parm) methods?

Posted on by 2,890

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

  • dolee Profile Picture
    dolee 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
    saman0suke 2,890 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
    saman0suke 2,890 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
    PA-22040759-0 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
    skaue Profile Picture
    skaue 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
    Rachit 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans