Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

Posted on by 345

Hi - 

   I have added a custom field "PRODUCTION TIME" on Report as Finished form "ProdParmReportFinished". This control is not datasource bound. I want to take the value of this control when the user clicks ok button. And use this value in a class which is outside scope  " jmgJobBundle" and "JmgRegistrationForm". 

User enters 100.00 in custom control Production Time and clicks OK.

pastedimage1563552628969v1.png

Now I have to take that production Time Value and use it to create a route card for Production Order. This is the requirement.

THE ISSUE - I'm not able to move the value of the control from the form to out of scope classes. Can you please give me some suggestions what can be done to achieve this functionality ?  I don't prefer adding a regular table to store values because that will require maintenance etc. Perhaps using args ? 

Thanks 

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    It seems you don't understand the difference between classes and objects. Classes are mere definitions of how objects will look like - what data they can hold and how they behave. Objects are concrete instances with concrete data (state).

    If you create an object and you want to work with it somewhere else, you must pass a reference to this particular object to the place where you need it. If you create a new object, you won't see the data of other objects created from the same class, because they are completely independent.

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    Yes it's a other way around . I just gave you it for reference . You can use similar process to pass it from form to class.

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    Hi -

      Your post is about passing the value from a class to forms data source. I need to pass the value from a form unbound control field to a class. It is the other way around. Will your post still work for this scenario ?

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    Simple web search could give you  ways to solve your problem

    mihaispoiala.wordpress.com/.../

  • Muhammad_Ali Profile Picture
    Muhammad_Ali 345 on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    Hi Martin -

     The best way I can explain is that fo example when I use a temp table to store the value of the control on the OK button clicked(). the value is first stored in the temp table which I can see in the debugger but as soon the code is gone out of the clicked method and on to the other classes the temp table buffer is empty with no records. to me this means that the temp table is now in the out of scope class. So my question is how  do I move the forms control value to the class which does not exist in the debugger path yet. I hope this gives you an idea of my issue.

    I can also say  yes to you question "Objects that don't exist yet ?"

    Please advice

    Thanks

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: Pass a Form control value to a class outside scope. Control is a custom Field which is not Datasource bound.

    What do you mean by "out of scope classes"? Objects that don't exist yet or not anymore? Or that you don't know how to get a reference to the object you need?

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,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans