Disable a field in a record based on a value in anoth field

david.weeks
Member Posts: 96
Hello All,
Should be simple this one but its not quite clicking...
I have a field called Sentforapproval. This is boolean.
This exists within the Sales Quote subform and within Sales Line.
If this is set to TRUE, I want to make the entire record un-editable, if the user goes back into the quote.
I have tried various methods including (for example) the setting of the currform.quantity.editable(false) within various sections including OnNextRecord etc.
It seems to work for one record but if there are three records in the subform, and not all have Sentforapproval = TRUE, they still get set to editable(false). This is the same if you navigate to another record, even if the particular sentforapproval is set to FALSE, the field in question remains locked.
Any ideas?
Am I missing something simple?
Should be simple this one but its not quite clicking...
I have a field called Sentforapproval. This is boolean.
This exists within the Sales Quote subform and within Sales Line.
If this is set to TRUE, I want to make the entire record un-editable, if the user goes back into the quote.
I have tried various methods including (for example) the setting of the currform.quantity.editable(false) within various sections including OnNextRecord etc.
It seems to work for one record but if there are three records in the subform, and not all have Sentforapproval = TRUE, they still get set to editable(false). This is the same if you navigate to another record, even if the particular sentforapproval is set to FALSE, the field in question remains locked.
Any ideas?
Am I missing something simple?
0
Comments
-
Hi David,
Try transferring your field to the header record. This will then allow you to choose any of the three lines on that subform and ALL will show the same status.
Then the code can be something quite easy such as...
If Header.SentForApproval=true then
Currform.Subformname.Editable=False
else
Currform.Subformname.Editable=True;
where Subformname is the name that you apply to the subform.
you will need to put this on the various triggers so that it cannot be bypassed by changing records etc..
Hope it helps.Remember: Keep it simple0 -
If you want to set selective editablity to the subform where some records are editable and some not then create a procedure for the main form and subform which accepts a boolean parameter which then sets editablility. If you want to make the entire subform non-editable then just create the function on the main form.
All you have to do then is to call this procedure on the OnOpen and OnAfterGetRecord triggers.
ie.
p_SetEdit(Sentforapproval = TRUE);0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions