Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Pass date value to a form

Posted on by 11,873

I run MenuFunction inside a class  method to  open a form.

How can I pass a date value from the method to the form to be used in a display method ?

*This post is locked for comments

  • Suggested answer
    cpironmo Profile Picture
    cpironmo on at
    RE: Pass date value to a form

    Hi, that would be perfectly acceptable, another approach which may help would be to create a class that extends the Args class and you can then add say a parmDate() method or parmContainer() method.

    This was you could directly pass a date object (parmDate) or a container (parmContainer), holding numerous date values?

    If this answer has helped you please verify it to help others see and use the advice given. If not let me know and we can work on getting there.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,104 Most Valuable Professional on at
    RE: Pass date value to a form

    Wouldn't passing an object (e.g. a Set of strings) be a little bit more object-oriented? You wouldn't have to bother with anything like string parsing.

    Also note that if your date values come from a datasource, you can pass a reference to the data source.

  • maram fraij Profile Picture
    maram fraij 11,873 on at
    RE: Pass date value to a form

    Thank you Chris.

    Just as an additional question, if I have to pass two date values, is it accepted to pass these values as comma separated string using Args.parm() method then do required string parsing in  form init() method  to retrieve these values?

  • Suggested answer
    cpironmo Profile Picture
    cpironmo on at
    RE: Pass date value to a form

    Use the Args.parm() method on the Args object you pass to the menu item.

    This method accepts a string value so set it using the relevant date2str method and then convert it to a date during the forms init() method using str2date method.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans