I’m IT student at University and at this semester we have subject where we creating tables/forms etc in Dynamics Nav. I’m have to create bunch of tables and forms and one of those tables is Seminar Registration Header. In this table I have some fields and now using C/AL I have make one of them uneditable. The line i specifications delivered by tutor says:
“You can change value of “Starting Date” field only when field “Status” has value “Planning””
“Starting Date” is Date field and “Status” is Option Field.
To be fair I tried very hard to do this. I don’t have experience in NAV that’s why I’m asking You guys. I hope that You will help me with this
Thanks everybody for advises. I did different way. I found on this forum, that I have access to property EDITABLE only from FORM. I had created FORM for this table and I modify trigger onValidate for Status field. When Status field is “Planning” “Starting Date”.Editable := True Else … := False; Works ! But thanks one more time for your advices !
Think about what you want to accomplish. If you want to accomplish that the field simply becomes grayed out and you can’t enter something, but JUST ON THIS FORM, then programming the form using the EDITABLE property is the right thing to do. If this needs to happen on other forms for the same tables, then you need to make that same change for every form for that table.
If you want to make it so that no matter which form, no user should ever be able to change the Starting Date unless that status is Open, then it needs to be in the field’s OnValidate trigger, like Mohana showed you. You can still change the value on the form, but it will give you an error message when you try. This is how most of the application is built, so that fits in right as it should.
If you were to do modify any data then you NEVER program that on the form.
You need to know the difference in behavior. Depending on the requirement you can then make a decision on what to do.
DenSter you’re right. I will use this only in one form. Maybe I’ll change this. I have another question for you guys. I have situation like this: I have field “Participant No.” and when I click F6 (it’s LookUp probably) nav will show list of contacts connected by “Bill-to Customer No.”. The tip from my tutor is to use three tables: Customer, Contact (joined many-to-many) with Contact Business Relation. Here’s my question. Is there any tricky way to FINDSET of those “Contacts” or do I have to create another table and join them in Table Relation property?