web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Customizing Boolean field

(0) ShareShare
ReportReport
Posted on by 390

Hello everyone, 

I have created a table "Item Model" along with its list and card pages. The table contains one Boolean field i.e. "Default". I want a functionality that whenever I mark Default=true for one of the item. The rest of the entries with same item no. should be automatically set to default=false and should become non-editable and when I make the entry having default=true equal to false then the rest of the entries with same item no.  become editable. In the below is the example that I want. For Item No.=1000 I want that if one default is set to true then the rest of the entries with same item no. should be set to false and become non-editable. and if I change the default from true to false then the rest of the default named fields become editable. Make sure that the process must for only those entries that have same item no. Kindly help. Thank you. 

  

I have the same question (0)
  • Verified answer
    Tech-Lucky Profile Picture
    1,267 Super User 2025 Season 2 on at
    RE: Customizing Boolean field

    The first part is you need to make other items with the same item No. as Default:= false for that you can use here the ModifyAll function Like the bellow

    write this code to Field "Default" OnValidate Trigger in Table
    var
    RecItemModel: Record "Item Model";

    RecItemModel .Reset();
    RecItemModel .Setrange("Item No.", Rec."Item No.");
    RecItemModel .Setfilter("Make Code",'<>%1', Rec."Make Code"); // if this is unique for other entries with the same item no otherwise this will not work try to use Primary Keys that makes the entries unique to prevent the current record to be modified
    if RecItemModel .findset then
     RecItemModel.Modifyall("Default",false);

    the editable or noneditable thing can be done with the help of Boolean variables on the Page level share your objects code if you still face issues to achieve this I will try to help you out in that as well.

    Please mark this answer verified if this was helpful.

  • Muhammad Anas Naeemi Profile Picture
    390 on at
    RE: Customizing Boolean field

    Thank you Tech Lucky, it worked.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,558

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,783 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 2,148 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans