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

Notifications

Announcements

No record found.

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,894

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)
  • Suggested answer
    Rachit Profile Picture
    4,015 User Group Leader on at

    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

  • Suggested answer
    Tommy Skaue Profile Picture
    Moderator on at

    Have you implemented the pack-unpack pattern?

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

  • PA-22040759-0 Profile Picture
    6,194 on at

    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.

  • saman0suke Profile Picture
    2,894 on at

    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!

  • saman0suke Profile Picture
    2,894 on at

    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?

  • dolee Profile Picture
    11,279 on at

    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?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans