Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Set Default Value for a Custom field , based on Production Status value "Created"

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

In production control -> all production orders 

For any Production order status value is "Created" then my custom field value should be set as "Hold".  How can i do that.

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    other simpler way could be to write your logic in insert() and update() method of the table

    problem with this if in standard logic doinsert() or doupdate() method is used for insert and update of record then there will be issue.

    But you can try.

    Please verify and update us with your findings

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    Hi Calavon,

    we can do that by x++ code but where to place the code. I am not getting.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    Hi Nitesh,

    This is not working for me.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    Hi Nitesh,

    Please note that the modified field is not executed when fields are changed in methods. Is it is executed when a field is modified in a form or Web form. As the Production status is not handled on the form contol for production orders, your solution will not work in this case.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    you need to override the modifiedfield method of the table (prodTable)

    write the code to assign "Hold" value to your custom field if Production order status field is having value "Created"

    Please verify and let me know if you need more details

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    RE: Set Default Value for a Custom field , based on Production Status value "Created"

    Hi Divija,

    You need to do this with some x++ logic. You can have a look at the method 'update' on the table ProdTable. This calls logic in classes ProdStatusType and ProdTableType with some inherited classes per production status and type. You can see which method on the ProdStatusType_Created is always called and add the logic here. You can also create new methods for you new field.

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans