Customization based on Company

pradeepgudipudi
pradeepgudipudi Member Posts: 8
Hi everyone,

Imagine a database having two companies A and B of different busines application in NAV. I just wrote some code in an object for company A and if i execute the same object for company B the code written for company A should not execute for company B. Is there any possibility in NAV..??

Regards

Pradeep

Comments

  • matttrax
    matttrax Member Posts: 2,309
    Sure, but it of course requires extra coding. Basically every modification you do is controlled by a check box in some setup form. When the checkbox is true for a company the code is executed, when it's false it isn't.
  • lyot
    lyot Member Posts: 202
    CASE COMPANYNAME OF
      "Cronus"://code;
      "Alfa"://code;
    END;
    
  • matttrax
    matttrax Member Posts: 2,309
    lyot wrote:
    Code: Select all
    CASE COMPANYNAME OF
    "Cronus"://code;
    "Alfa"://code;
    END;

    Because that won't blow up horribly if you rename your company. ](*,) And what happens if you add a new company? Going to go change every object again?

    You should never hard code things like that.
  • lyot
    lyot Member Posts: 202
    True...
  • DenSter
    DenSter Member Posts: 8,307
    Add parameter fields to the Company Information table.
  • pradeepgudipudi
    pradeepgudipudi Member Posts: 8
    thanx for the help.. :D
  • j.marselo
    j.marselo Member Posts: 102
    DenSter, Matt,

    my abstraction is so weak and i can not visualize clearly your suggestion.

    is it like adding a checkbox in Company table:
    AllowCustomization : [ ]
    

    then starting every block of code lines with something like:
    if companyinformation.allowcustomization then begin ...
    

    if it's true, i'm not sure this will work.
    but, i may wrong in understanding your points. Can you please describe further?
    Kind regards, Joe Marselo | see my NAV blog joemarselo.wordpress.com | twitter @joemarselo
  • DenSter
    DenSter Member Posts: 8,307
    The question was to make a certain piece of functionality only available in certain companies. The easiest way to do this is to provide a way to turn the functionality on based on certain setup information. Wheter that is a checkbox or a field that can be used to enter information, that all depends on the design of the solution.

    The consensus was that hard coding company names was NOT the right way.