SysDictTable is not synchronized.

Hello,

I have run into a problem in the standard code (which I didn’t change it, and I don’t understand why is the problem) on SalesPurchJournalSelect.setJournalHeader_allowEdit()

Here is the code :


protected void setJournalHeader_allowEdit()
{
SysDictTable dictTable = new SysDictTable(this.journalHeader_ds().table());
Counter i;
FormDataSource fds = this.formDataSourceAll();
;

for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
{
this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)).allowEdit(false);
}

for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
{
fds.object(dictTable.fieldCnt2Id(i)).allowEdit(false);
}
}

For the line :

this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)).allowEdit(false);

I got (when i=37) the exception of null object (And that is the first field I added to the table PurchParmLine).

I have tried to do synchornize, also delete the new fields and add them again, but still the same problem.

I see that fields are on sqlDictionary with appropiate index, but on :

this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)) the object is null.

  • but I cannot see what may be the problem cause (Why SysDictTable is not synchronized with my table).

Thanks :slight_smile:

Check map for you table(I think it should be CustVendInvoiceJour). New fields must have mapping.

I didn’t understand why should I map the table, and how can I check what is the map object?

(Specifically for the sample, I gave).

Thanks :slight_smile:

Can you set break point on line fds.object(dictTable.fieldCnt2Id(i)).allowEdit(false); and write here value of dictTable object?

The exception is for the lines :

for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
{
this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)).allowEdit(false);
}

this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)) returns null for just putting a field on purchParmLine (which is the journal header table in that case).

With what function you run this code?

I don’t have at the right moment access to Dynamic AX (2009), but it is something like :

Account payable → Purchase Order list → (choosing recieved), and then post → post invoice.

If there is an error on that line, I can fix it (there is a button for that), and the most bottom and most left button on the new form openned.

It is a standard form.

just dictTable is not synchorized with changes on the corresponding table.

DictTable is a class, so I need to know farther - how this class fills it’s data (and which tables).

Thanks :slight_smile:

How did you know that the problem in the table PurchParmLine? I’m just interested in the progress of your thoughts.

Well …

I have put on the code, instead the first loop :

info(dictTable.name());

for (i=1; i<=dictTable.fieldCntWithoutSys() ;i++)
{
info("purchJournalMatch_Invoice.setJournalHeader_allowEdit " + int2str(i) + " : " + int642str(dictTable.fieldCnt2Id(i)));
if (this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)) == null)
info("object = null. i = " + int2str(i));
else
this.journalHeader_ds().object(dictTable.fieldCnt2Id(i)).allowEdit(false);
}

First info returns : PurchParmLine.

I got to this by :

Account payable → Purchase order details → Posting → Posting invoice → Matching details → there is “Total packing slip mismatch” (only on that situation).

Then I press the button next to “Total packing slip mismatch” (on form : PurchInvoiceMatchingDetails - goto another form PurchJournalMatch_PackingSlip), and then got the message.

So I have seen on another enviroment, that even adding new column to the PurchParmLine table, give the same problem.

The two enviroment are duplication of each other (one is development, and the second is test before loading to production).

I think something went wrong with the sysDictTable or related objects.

But if indeed there is something wrong with related objects - how can I fix that problem?

Thanks :slight_smile:

:slight_smile: All ok with SysDictTable. You should add your new field for purchParmLine at form PurchJournalMatch_PackingSlip.

For example: I add Field1 at PurchParmLine. And add this field in Grid at form PurchJournalMatch_PackingSlip. No errors. Try it.

No, No that kind of answer !!!

I did that - same problem again.

It’s not a good solution, since Billions of lines of codes are on Dynamic, and adding column to single table should force me to check all the relevant object, and I don’t know what other forms may have the problem (I cannot check the whole Dynamic AX for that).

You won’t reach the problem, because it seems kind of synchonization problem, that means something on the database, so I am looking for a fix to that.

Maybe your database is OK.

I need to invastigate the internal tables of the Dynamics - It’s seems too complicated.

For now - an Ad Hoc solution is to put on the code of setJournalHeader_allowEdit, and check if null.

SysDictTable is wrong, and is obviously seem to be a way to fix that, but how - I don’t know for now.

Thanks, anyway :slight_smile:

I’ve had the same exact problem, exact same table, class and method and agree with you, there should be a way to avoid having to find and update all forms that use an updated table as a datasource.

But it seems that the only current solution is to right click the form (PurchJournalMatch_PackingSlip in this case) and select compile and then restore.

This fixed my problem.

If another solution is available, I would be very interested.

Hopefully to find a tool that fix the SysDictTable and related (SysDictTable is a class that holds some data of table).

Thanks :slight_smile:

What is your opinion about this link (I didn’t check it yet).

Can it harm? it build the sqldictionary, but I think I should do the opposite (build sysdicttable from sqldictionary).

http://vaillancourtm.blogspot.com/2010/08/rebuilding-sqldictionary-entries-to.html

Hi

I got this error. When debug i tried to add a info message and debug, after debug the error clear.

Tablename_ds().object(dictTable.fieldCnt2Id(i)).allowEdit(false);

Info(strfmt("%1", dictTable.FieldName(dictTable.fieldCnt2Id(i))));

I don’t know why, but it work.