I want to create a table which will store parameters, so it will store exactly one record at all times. Usually parameter table is created for a specific module, but in my case I want to create a parameter table which is not necessarily related to any specific module or a company. So probably you already guessed that the property SaveDataPerCompany will be set to No. It must be possible to see the record in this table from any company.
I read Microsoft’s design pattern about parameter tables and I have a question. First of all let’s clarify that their design pattern is for the case when you’re creating a table for a module. But I think my case isn’t that different… I understood everything except one thing.
Parameter table must always store exactly one record. So we’re overriding method validateDelete() and we’re restricting deleting records. Also, we’re restricting creating a record. But that one and only record must be created somehow, right? So in the Microsoft’s design pattern they’re inserting a record in the find method of the table only if there are no records in the table by calling Company::createParameter method. And this find() method is called in the Class Company, method selectParameters. But I couldn’t find where is the call to this method. When is this one record inserted in the table? What triggers the insertion to the parameter tables that should happen only once? I tried few things but couldn’t make breakpoint hit selectParameters method.
I have a workaround for my case, I’m just calling find() method in the init() method of my form, so whenever a user wants to see the parameters he/she has to open a form and that’s when I check if there are any records in the table, if there are none, I will create one, if there is one, I won’t do anything. This will work, but I want to know how exactly is this “issue” solved in case of standard parameter tables.
It doesn’t matter which version of AX you’re familiar with, I’m interested in any case.