Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

read only combo box for specific Item number

(0) ShareShare
ReportReport
Posted on by 10

I want to make the category read only when the item number is "SMS*", and when the item number = other value(not "SMS*") , the category still can be edited.

Can anyone give me a hint or a sample code.

Thank you in advance.

pastedimage1604657627139v2.png

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,735 Super User 2024 Season 2 on at
    RE: read only combo box for specific Item number

    Hi Obsidian123,

    At least consider using e.g. a parameter or new table to setup which category or categories would be restricted. The requirement is now about the SMS category, but next month, it could be changed to SMS and another category. Check with the client if they expect a list or just one category to be restricted.

    Then based on the table setup or a parameter, you can add the coding as suggested above by Martin.

  • obsidian123 Profile Picture
    obsidian123 10 on at
    RE: read only combo box for specific Item number

    I'm sorry that I forget to say that when the item number is "SMS*" the category will be automatically set to "SMS", and my client want it can't be changed(read only).

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: read only combo box for specific Item number

    I agree with Martin, don't hard code any "SMS" check in your logic. Instead add a new checkbox  InventTable (or EcoResProduct) to control the behavior. And you can also add it in "Create new product" / "Release product" dialog/s so that the person who creates / releases the products can set it.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,466 Most Valuable Professional on at
    RE: read only combo box for specific Item number

    Run the logic in active() method of the form data source.

    Get a reference to the data source field (this.object(fieldNum(...))), call its allowEdit() method and pass true or false, depending on your logic.

    By the way, the fact that you need to extract a part of item number suggests that your data model isn't correct. The attribute isn't atomic.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans