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.
Thank you Tech Lucky, it worked.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156