Options

calling codeunit from menusuite

KarenhKarenh Member Posts: 209
edited 2015-09-21 in NAV Three Tier
Is there a problem in calling a codeunit directly from the menu? I have been told by several people at a solution provider to NOT do that, instead to have the menu call a processing only report and to have the report call the codeunit. No explanation, other than "this is not classic".

Since the menusuite does allow object type Codeunit, and I see the some codeunits called from the menu in the Demo Database menu, I am puzzled by this.

Does anyone know of the reason behind this prohibition? Thanks.

Comments

  • Options
    mrealm1mrealm1 Member Posts: 15
    I think that it is a matter of design and the codeunit that you are calling and its function.
  • Options
    KarenhKarenh Member Posts: 209
    Thank you mrealm1 for the reply.

    The purpose of the codeunit is mass edits of migrated data (purchase orders, sales orders). It is a re-implementation. There are too many POs and SOs to enter manually. I am importing using Rapidstart. There have been heaps of changes in related tables (currency code, posting groups, country/region code, etc) and some decisions are still being made.

    I used the codeunit from the menu in the test db to delete bogus imported sales header records. Nothing blew up. It worked as I expected. The only reference materials (MSDN, Brummel's book) mention calling codeunits from the menu in passing as part of a list of objects. So I don't understand why two staff from the solution provider have told me not to do it. Their recommendation, to have the menu call a processing only report, and have the report call the codeunit, seems unnecessarily complex. If I had to get a processing only report involved, I was just use it and not a codeunit at all.
  • Options
    mrealm1mrealm1 Member Posts: 15
    They may have had a reason or a deeper message. As long as your code has proper validation and some sort of control (i.e. cancel, confirmation, etc..) there shouldn't be an issue. Without knowing the whole design, a report calling a codeunit may be much and does consume two objects, unless it is a case where it fits a design pattern for centralizing and reusing code.
Sign In or Register to comment.