Can't help as you did not post any code. BUT on the off chance that you haven't already looked at this. you could compile the example "Notification_Manager" which gives a example of storing info to a element.
The example stores type, GUID, & time to the selected element(s). Just tested it and it works for me and does save the data upon exit of Archicad. The menu items are "Mark selected elements" for data storage and "List/Check owned elements' for data retrieval. You may want to look at the code which is in "Element_UserData.cpp" in the "Notification Manager" example.
Gerry
Windows 11 - Visual Studio 2022; ArchiCAD 27