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)

Save checkbox parameter in a RunBaseBatch

(0) ShareShare
ReportReport
Posted on by 2,894

Hi, I'm created a form that is being called by a class extending from RunBaseBatch with two parameters, one Description type and another one which is NoYesId, when I create the batch and look at the parameters, the checkbox value is not saved, this is what I have:

In the form, an edit method that calls the parmMethod in the class:

edit NoYesId editNoYesId(
boolean _set,
NoYesId _noYesId
)
{
if (_set)
tutorial_RunbaseForm.parmNoYesId(_noYesId);

return tutorial_RunbaseForm.parmNoYesId();
}

Then in the class:

NoYesId parmNoYesId(NoYesId _noYesId = noYesId)
{
;
noYesId = _noYesId;

return noYesId;
}

Am I missing something? thanks!




*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at

    You need to look at the implementation of the pack/unpack methods in the class - most probably, they use a local macro (declared in classDeclaration) called CurrentList

    You need to update the contents of that macro, adding the noYesId class variable to it, and then update the currentVersion incrementing it by 1.

    See tutorial_RunBase* classes for examples on how to work with RunBase* classes

  • saman0suke Profile Picture
    2,894 on at

    I guess you are right, this is the classDeclaration from an example that I got in AX:

    class CopyOfTutorial_RunbaseForm extends RunBaseBatch

    {

       // Packed

       TransDate       transDate;

       CustAccount     custAccount;

       //NoYesId

       NoYesId         noYesId;

       SysQueryRun     queryrun;

       DialogField     dlgtransDate;

       #define.CurrentVersion(1)

       #define.Version1(1)

       #localmacro.CurrentList

           transDate,

           custAccount

       #endmacro

    }

    I need to add my parameter there (NoYesId) so what I did was to add it and increment the CurrentVersion to 2, but it did not work, what exactly do I need to modify, which macros? thanks!

  • Suggested answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at

    The macro called CurrentList at the very end of the classDeclaration above

      #localmacro.CurrentList

          transDate,

          custAccount,

    //add this

          noYesId

      #endmacro

  • saman0suke Profile Picture
    2,894 on at

    I just did that and It did not work; is there something else that I might be missing? I'm following the example in the AOT Tutorial_RunBaseForm, just adding a checkbox of type NoYesId instead of textfields, maybe the edit method in the form does not work?. Thanks for the help in advance.

  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    Did you increase the value in the CurrentVersion() macro, as I mentioned in the first reply?

      #define.CurrentVersion(2)

      #define.Version1(1)

      #localmacro.CurrentList

          transDate,

          custAccount, noYesId

      #endmacro

  • saman0suke Profile Picture
    2,894 on at

    I just did that with no luck, if you need more code I can post it here, maybe I'm missing something, I did the same example, but instead of using a form, I just the class and create the parameters in runtime, but I need to use a form, thanks!

  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    well, you should post your form code + class code, maybe the entire XPO, so we can try it out on our system.

  • Community Member Profile Picture
    on at

    have you tried clearing up SysLastValue for this class? i have seen similar issue when i add new variables in CurrentList. Usually clearing up SysLastValue for the class worked for me so far.

    Venkatesh

  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    Just as an off-topic education point - that's why you should change the value of the CurrentValue macro whenever you change the CurrentList - it controls, whether or not the SysLastValue record will be used to initialize the class variables, or if they will be initialized with default values.

  • saman0suke Profile Picture
    2,894 on at

    How do i clear the LastValue? I have the xpo here as an example, I would appreciate the help.

    https://www.dropbox.com/s/e4qezldh6wg896q/SharedProject_TestProject.xpo?dl=0

    Thanks,

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