Options

Inserting records into common tables before company is open

davmac1davmac1 Member Posts: 1,283
I am trying to write security table changes into a log file with property "data per company" = no.
When I do this with no company open, nothing gets written to my custom table. If I look at what is happening thru the degugger, it creates all the field values in the table and then when it hits the INSERT line, all the record values show as unitialized.
Is this just the way Navision works, or is there a way to make this work properly?

(It has no problem inserting into the Navision user, member of, and permissions tables with no company open.)

Comments

  • Options
    ara3nara3n Member Posts: 9,256
    Is there a reason why they aren't using change log? Its a lot cheaper to purchase the granule than making customization.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    davmac1davmac1 Member Posts: 1,283
    1) change log does not record anything if there is no company open
    2) change log is per company - so you have to look in every company for security changes - which is a big deal if you have 30 companies
  • Options
    ara3nara3n Member Posts: 9,256
    1) change log does not record anything if there is no company open
    1) Error out if companyname = '' onmodify trigger

    2) change log is per company - so you have to look in every company for security changes - which is a big deal if you have 30 companies
    3) A report should be sufficient to run. Or Allow the Security to be setup only in one company. onmodify trigger
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    davmac1davmac1 Member Posts: 1,283
    I customized the change log to handle no company open for security changes and it executes all the code until it hits the insert statement for my custom table.
    Since inserts into the security table work okay, does something in Navision block inserting into custom tables?
  • Options
    ara3nara3n Member Posts: 9,256
    is this on sql or native?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    davmac1davmac1 Member Posts: 1,283
    This is on native version 4
  • Options
    ara3nara3n Member Posts: 9,256
    I just tested in 4. sp3 and it works fine.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    davmac1davmac1 Member Posts: 1,283
    You were able to log security changes when no company was open to a custom table with data per company no?

    Did you use codeunit 423 - change log management or put code in the table triggers?
  • Options
    ara3nara3n Member Posts: 9,256
    no i inserted into the table directly. Yes the insert is done when the no company was open.

    The new table company independent.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    davmac1davmac1 Member Posts: 1,283
    Originally I was going to do direct updates, but codeunit 423 seemed the easy way to do things.
    I will try direct inserts instead.

    I will see if any Navision development staff know why it behaves like this at Convergence.
    It does seem like a design hole to allow security changes with no company open and then not track them.

    Thanks for your help.
  • Options
    ara3nara3n Member Posts: 9,256
    No problem. See you at convergence.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.