Adding a field to the customer card

td323itd323i Member Posts: 26
Hello,
I need to add a field called "Date Opened" to the customer card so we can keep track of when customer accounts are opened. I think the step i'm missing is creating the table to hold the data. I can add the form data to the card, but can't remember how to add the field data or table to the system. Any help will be greatly appreciated.

Thanks,
Td

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    In order to add fields to tables, you need to have the appropriate design-rights.

    Go to Object Designer -> Tables and choose the Customer table. Now click on the "Design" button and you see all fields of this table. Now pick a field number >= 50000 and <= 99999 which is not used, and enter a new line for the new field with this number. Name of the field will be "Date Opened" and type will be Date.

    Now press Ctrl-S to save this table. If you don't have enough permissions, you won't be able to save this modification. After this, you can add this field to your form.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • diptish.naskardiptish.naskar Member Posts: 360
    Hi Td,

    Follow the steps to acheive the functionality.

    1. Go To the object designer and add a go the design of the customer table.

    2. add a new filed in the customer table called date created datatype:date in the 50000 series

    3. Save the table

    4. press f9 to go to the code and add the following code on the OnInsert() trigger

    date created:=today;

    5. Save the table and exit to the object designer

    6. Select the customer card and go to the design view, using the menu editor add the filed to the form(you can set the properties of the text box as desired i mean editable/non editable etc.)

    7. Save the form and exit

    I hope this will give you the desired functionality.
    Diptish Naskar
    For any queries you can also visit my blog site: http://msnavarena.blogspot.com/
  • WaldoWaldo Member Posts: 3,412
    What do you mean with "when customer accounts are opened"? Do you mean when they are created? Or when someone opens the customer card and views that customer.

    For the first, follow the steps above;

    For the second, you'll have to do some coding on form-level. OnAfterGetRecord trigger you can add your code to update the field. I can't imagine though that you want this, because it creates quite a big load on the database (e.g. disable your "find as you type" feature if you do this [-X ).

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.