SidePanel plugin save variables to server?

I have a smart client SidePanel plugin, I want to store a variable to the server. That will persist shutdowns of SmartClient.

I have tried ClientSettings.SetProperty(“key”, “value”); in combination with ClientSettings.Save() creating the instance of ClientSettings with the FQID of the masterServer, and various different ways.

If I do the GetProperty immediately after the SetProperty and Save it works. However when I create another instance of ClientSettings using the same FQID of the masterServer the GetProperty(“key”) returns null.

Any ideas why this Is not working? Is there a better way to save variables? I also thought Metadata looked promising but I can’t find a way to instantiate a new instance.

Please explore the Property plugin sample - https://doc.developer.milestonesys.com/html/index.html?base=samples/property.html&tree=tree_search.html?search=property+plugin

Rie,

Thanks for the reply.

I did that last night and I ended up using virtual void VideoOS.Platform.Configuration.SaveOptionsConfiguration(…) and it worked for me. I need a very general variable saver that is not specific to a class that inherits from a given plugin so this in the only option I saw that fit my needs.

My issue is there is no corresponding DeleteOptionsConfiguration. I have no idea where the configuration is saved and how to delete it.

You can use an empty Xml document in the SaveOptionsConfiguration method, this will work as a deleting method and remove the value of the property.

I experimented with the Property sample and I have the following snippet of source code that might be helpful for you;

VideoOS.Platform.Configuration.Instance.SaveOptionsConfiguration(Property.PropertyDefinition.MyPropertyId, false, emptyXml); 

I had to move on and use a SQL database to store variables. The GetOptionsConfiguration worked like 90% of the time for me-it was not reliable. Even in the simplest unit test of SaveOptionsConfiguration followed by GetOptionsConfiguration would pass almost always then randomly fail.

The returning of void for so many of your functions is difficult. It would be nice to know if the SaveOptionsConfiguration passed (maybe even return an error code would be great).

It was also unclear if putting in Xml.Empty just nulled out the variable or deleted it. A DeleteOptionsConfiguration function would be nice.

The Property sample has a weakness. If you at the same time has the Sidepanel and the Viewitem they will interfere with each other. You change something in the Sidepanel and it is saved, you the change view and the Viewitem overwrite the previous save and you are back to not saving changes.

Might this be the explanation? Can you verify that nothing else in your integration overwrites the options configuration you save?