Just wondering what the correct method is to set the configuration interface values programmatically?
I am trying to store a token but having a hell of a time with it. The values do not seem to be updating correctly.
Here is the code I am currently trying. After running this with the new token and looking at the property in the admin - app properties area the value doesn’t change. But it does change after a while. Or maybe after a restart…
generally, you can use a setter method in the config interface in order to save values to the DB. I’m not sure about the cache invalidation though. Perhaps you have to clear that manually.
Perhaps you have already seen it: I created a Xero integration component which seems to do similar things. Perhaps you want to take a look and see if you can leverage some of the work: Xero – CUBA Platform.
Mario, I did have a look at that.
Unfortunately Xero is forcing the stricter Oauth2 with callback in March so that will become unusable.
I’m going to have a go at storing the variables with the setters but also locally within the service. So that the service uses the local variables first but on restart will reload them from the configuration interface if they are null. Presumably that will solve this… Just have to keep waiting for the token to expire to test!
I could make my component public if anyone is interested in contributing. Xero is a very popular accounting platform and it would be great to have an up-to-date addon for Cuba.