A recent newsgroup post asked about how to fix the error message shown below from occurring when clicking the Attach button on the Note window for a record level note.
“The note ID has not been set.”
The cause of the message is that the ‘Note Index’ value for the Transaction or Master record has not been set and so remains at zero.
The post Understanding Notes and the Note Index field explains how the Note Index is used and where the next Note Index comes from. It also explains how cross linked notes can occur. This post will discuss missing Note Index values and how they can occur.
The usual cause is because the data has been imported in some way and the import process did not populate the ‘Note Index’ field. Depending on what the import process actually is, you might need to log this issue with support so that it can be fixed.
Also, If you can make this problem occur for a master record or transaction newly entered via the user interface, then there is a bug in the code for that window and you will need to log this issue with the developer.
So, once there is data with a missing Note Index value, how can we fix it…. The answer is “easily”.
My friend, Robert Cavill, provided me with a script he had created which can scan a table for missing ‘Note Index’ values. The script updates the table with the next Note Index for the company. It does so by using the existing DynamicsGP stored procedure: smGetNextNoteIndex. This AssignNoteIndex.sql script is attached to the bottom of this post. You just need to specify the table name to process by editing the value at the top of the script.
Before using AssignNoteIndex.sql, I would suggest running the script in the Knowledge Base (KB) article Cross-linked or incorrect notes indexes in Microsoft Great Plains (KB 872678) . This will ensure that the Note Index values used are higher than any existing values. The FindMaxNoteIndex.sql script from this KB is also attached to the bottom of this post.
Should you make regular use of the sample company Fabrikam (TWO database), I would also suggest running the FindMaxNoteIndex.sql script on this database as well. This is especially worthwhile if you have third party products that have added sample data.
The AssignNoteIndex.sql script and the FindMaxNoteIndex.sql script are available from the attachment at the bottom of this post. They can be executed against any company database.
For other posts on the topic of Notes and OLE Attachments see the following posts:
I hope you find these scripts useful.