Meet the Pattern
Send information (parameters) to a processing framework/routine so that it knows what to do, how to behave, .. .
Know the Pattern
For a processing routine to behave correctly, it needs sometimes input of a user to know what it has to do, check or avoid doing. To do this, usually a piece of UI is getting called (STRMENU) with the question what to do. These input needs to get to the routine.
Use the Pattern
Example: Sales Post.
On Sales Header, there were fields created which act like internal parameter-fields for the "Sales Post" routine:
When pressing "Post", the Selection Codeunit is getting called:
Or in case of the Post&Print, the selection codeunit is different:
Next, the user is able to select the options with an STRMENU, which results in filling in the fields above, like:
Selection := STRMENU(Text000,3);IF Selection = 0 THEN EXIT;Ship := Selection IN [1,3];Invoice := Selection IN [2,3];
The processing codeunit is being called after these options were set.
This is also being used in the Purchase Post.
However, the Service Post works different. In Short:
Ideas for improvement
Implement it consequently. There is (in my knowledge) no reason to do Service Posting differently from Sales and Purchase.
Furthermore, one might argue if adding fields to a table (which also means adding fields to the SQL Table) is the right solution to pass parameters to processing methods.
On the other hand, as we are handling tables as being "classes" in many cases, it does make sense to add "properties" to those "classes" to change the behavior of the method (SalesHeader.Post).
I would like to add a pattern like "Using Argument tables" (as a sub-pattern for the facade-pattern). It somewhat is related to this way of handling parameters: using tablefields to pass a flexible amount of parameters to functions/codeunits.
I agree to Waldo that parameter fields should not be added to SQL table. Actually you could solve this by defining these fields as FlowFields with blank calc formula property.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics