Mandatory Field on sales order
kenl
Member Posts: 182
Hello,
On Sales order form, I would like to force the user to input the "Request Delivery Date". How can I do it?
I try the following method but fail:
1) Go to Table, set the field property "NotBlank" = Yes.
This only work when I clear the content of the field. If I never go to that field, system will by pass the checking.
2) On Table, set checking in OnInsert() / OnModify()
This doesn't work since when we click F3 on sale header form, system will insert the record. If I put the checking there, system will throw error immediately.
Any idea? :-k
On Sales order form, I would like to force the user to input the "Request Delivery Date". How can I do it?
I try the following method but fail:
1) Go to Table, set the field property "NotBlank" = Yes.
This only work when I clear the content of the field. If I never go to that field, system will by pass the checking.
2) On Table, set checking in OnInsert() / OnModify()
This doesn't work since when we click F3 on sale header form, system will insert the record. If I put the checking there, system will throw error immediately.
Any idea? :-k
0
Comments
-
Maybe you could make a check function on the form and call that function from the onaftergetcurrrecord (test on xrec) and in the onquerycloseform?
I have not tested this and I don't think everything will be perfect but there really is no perfect way to do this in navision... :whistle:0 -
If you want to test it before posting put a TESTFIELD for this field in CU 81.
If you want to test it before the insert select "Delayed Insert" = YES in Sales Header Form Properties and use your second method.Kai Kowalewski0 -
Hello,
The "DelayedInsert" on the form doesn't work for Sales Order, since when I set DelayedInsert= Yes, system cannot get the Sales No. from Number series.
Finally I write a check function (TestField(...)) in Table SalesHeader. When they press the button Post, I will call the check function.
Maybe there is no "Perfect" solution for this case. Anyway, thank for all of you.0 -
You can do this by programming code on the Form. In one of the form or field triggers. I don't have an example with me right now. But it could be something like checking the field before leaving for another field. Or check a field when activating another field.0
-
Better to write the test in CU 80, because it is possible you don't use CU 81.If you want to test it before posting put a TESTFIELD for this field in CU 81.
This is to block at the ultimate moment the posting.
For the rest:
You can put a message in the OnInsert and OnModify triggers of T36 (and maybe also of T37), to remind the user he has to fill in the field if he hasn't done it.
This is how I would do it. Remind the user he has to do something and block him if he hasn't done it before it is too late (=before posting).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I would not recommend that.kriki wrote:Better to write the test in CU 80, because it is possible you don't use CU 81.
If it is a manual post, CU 81 is used. If it is a batch post, who is going to know the "Requested Delivery Date" if it wasn't filled in ? This will cause the whole batch to stop for a field of marginal importance.
Besides, CU 81 can be modified with a customers licence, CU 80 cannot.
The document no. can also be drawn in the OnValidate of the No. Field if you copy the code from the insert trigger, but it is necessary that the cursor is in this field for it to work. Might be worth a try.The "DelayedInsert" on the form doesn't work for Sales Order, since when I set DelayedInsert= Yes, system cannot get the Sales No. from Number series.Kai Kowalewski0 -
Don't worry, the whole batch will not block, because codeunit 80 is called as follows:If it is a manual post, CU 81 is used. If it is a batch post, who is going to know the "Requested Delivery Date" if it wasn't filled in ? This will cause the whole batch to stop for a field of marginal importance.IF SalesPost.RUN("Sales Header") THEN BEGINThis traps errors in the codeunit to avoid that the error blocks everything.Besides, CU 81 can be modified with a customers licence, CU 80 cannot.
1) Normally customer-licenses don't allow changing of objects (except if they have some designer-granules.
2) And if they can, a reason the more to do it in C80. It is better to avoid that customers change objects. It only gives problems.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I meant external batch imports from POS systems, not the internal post batch in Report 296. If you put a testfield in a posting routine for a field which is nice to have but not essential this often causes unnecessary problems over the years when new demands have to be met. I prefer to do these additional tests before the posting routine starts to keep this as universal as possible.
From my experience,if the customer has paid around 6000 EUR for the solution developer granule he usually wants to do something with it. If you then tell him to keep his hands off CU 81 or Report 296 even though he can modify these, you might leave him somewhat angry. CU 80/81 functions could also be one handled in a single codeunit, but the fundamental coding in CU 80 has to be kept clear of an end user modifications. That is one of the reasons for the existence of CU 81, if you put potential bugs in this one these will be somewhat less critical than the ones in CU 80 which can bring down the whole system.
Kai Kowalewski0 -
Better say him he doesn't need to spend that much. And then even more to fix the bugs they put into it (See my signature). A lot of times it is cheaper to let us do all the programming.From my experience,if the customer has paid around 6000 EUR for the solution developer granule he usually wants to do something with it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
