Custom variables' values are not shown in the task for a workflow started from webscript untill the application is restarted.

TLDR: When I start a workflow using java web script, all of my custom variables don't have their values visible in the tasks (which I set with the webscript when starting the workflow) until I restart the web server. After the restart - they are visible and If I execute the web script again to start another workflow, then for both of the workflows all my custom variables in the tasks are not visible. If I restart the web server they appear again. This is a really strange behavior. Please help.

I am still new to Alfresco and I am doing my best learning it but I have some troubles with updating workflow variables from webscript using the Public Java API. After some research I was able to start custom workflow from my web script using a java class which I will paste at the bottom but I have problems with setting my custom variables. Summary of the problem: It appears that my custom variables are being set on execution and also on task level, but for some reason Alfresco is not showing their values in the tasks?!?

I did the following test: started a workflow using the webscript, then I checked the task and nothing was populated. Then, I just restarted the app server and without doing anything else when I checked the same task - the properties were visible. Also, if I start another workflow with the webscript, then the variables in the tasks for both workflows are disappearing again until I restart the app server again. Does anyone know what may be causing this or how can Iissue an update or something, without restarting the app server?

When I restart the app server - they are visible again. Here is the class that I am using with my web script:

public class StartWorkflow extends AbstractWebScript { /** * The Alfresco Service Registry that gives access to all public content services in Alfresco. */ private ServiceRegistry serviceRegistry;