How get session cookies from UI Designer

Hello,
After log in bonita portal, it returns X-Bonita-API-Token and JSESSIONID. I am trying to get this values from in ui designer but i couldn’t get the values. From cookies of browser I managed to retrieve X-Bonita-API-Token but i couldn’t find JSESSIONID.

In documantation, it says it can be retrieve with /API/system/session/unusedId but it return only this

{"copyright":"Bonitasoft © 2019","user_id":"85","user_name":"walter.bates","session_id":"7204332265212713445","conf":"[\u00228B39D01728AE42A81840D858575C113696B42079\u0022,\u0022784E8C66FB98D5F1DEF0BD71B1DE64A03F5DF9EC\u0022,\u0022BE5C39A57B38FF31B0DEF3ADA537A30D17B3BF19\u0022,\u0022DA427A8A2774B09F53C0EA8D6BCA45DCF1B1316E\u0022,\u0022B058A3AA89113486257EDF2DA2BDCA921EEB1317\u0022,\u00227D9B9C4833A787B9E90A7B191BB4D71A88E83155\u0022,\u0022BC47CED123D280BA9E67780B0550AB2FD3B3E29F\u0022,\u0022C2963DFB98F26431E783131F8CDDA9BC496C7B3B\u0022,\u00229A9050E8C3DA8B02525B86EB8DA42BB813CEA03B\u0022,\u0022223D7776F403577A91E3E80452C1EEBEE961ADCE\u0022,\u0022953F2739250B1FC110F23200BAC60CE9BA0CC207\u0022,\u002229BAF62A2F0D73A489A7AFD109C4CB6FDA9DF676\u0022,\u00225DB3EE98E0BB0E0271D524FC1EE54F9E7DAB459B\u0022]","is_technical_user":"false","version":"7.8.3"}

Maybe it is in conf value but it seems cyphered.

In order to access a Bonita form or a Bonita page the user always need to be logged in and so you don’t need to deal with X-Bonita-API-Token or JSESSIONID in such forms/pages.

If you declared in your form or page a variable initialized with a REST API call to Bonita API the HTTP request will always include the required cookies.

Yes, i know that but what i want to do is something diffirent.
I will explain what i want to then maybe you can suggess me to something.

I want to create a process that returns multiple items in contract.
Like, input : [ {"input1": 1, "input2": 2},{"input1": 5, "input2": 6}, ...]
For each of that items i want to call a process. I can do that with activities but with them all my sub processes are linked to main process. There is no new case id, there is no new case. With that i can’t track processes. What i want to do is create a process and in that process use Rest POST connector and call to sub process with REST, than every call will create a diffirent case. After that i can check and track every case. Since i can’t get user passwords from groovy and i don’t want to ask users to write their passwords as input, i can’t use REST connector to create login request and also user already loged in and i want to use these login cookies.

Maybe i can do it with creating custom widget that can make post request for each item but it could be very slow to execute every post. Because of that i want to do this with connector so that user wouldn’t notice how long it takes and doesn’t have to wait.

As you notice, in Bonita Portal only the parent process instances are listed and tasks of child processes are listed as belonging to the parent.

So if you don’t want to use call activity (and have child process instances) I can recommend an easy solution. In the process that is used to start other processes (I will call it the “launcher”), configure a Groovy script connector on start of this process. Groovy script should be as follow:

// Get a reference to Bonita Engine Process API
def processAPI = apiAccessor.processAPI
// Get the id of the user who start the "launcher" process
def userId = processAPI.getProcessInstance(processInstanceId).startedBy
// Get the id of PoolA process in version 1.0
def poolAProcessDefinitionId = processAPI.getProcessDefinitionId("PoolA", "1.0")
// Get the id of PoolB process in version 1.0
def poolBProcessDefinitionId = processAPI.getProcessDefinitionId("PoolB", "1.0")

// Start PoolA with empty contract inputs (adapt this to your use case to reuse launcher process contract inputs to set the value of the last function parameter)
processAPI.startProcessWithInputs(userId, poolAProcessDefinitionId, [:])
// Same as the line above but for PoolB
processAPI.startProcessWithInputs(userId, poolBProcessDefinitionId, [:])

// The script does returns any information that should be used in the process
return null

This script will start a new instance of PoolA and PoolB on behalf of the user who start the “Launcher” process.

An alternative to this solution is to send BPMN messages (one for each process definition to start) in the “launcher” process and use “start catch message event” in PoolA and PoolB. Note that if you are using messages you will need to store at least temporally the “launcher” contract value in business variables before using them in the “throw message events”. Also when using messages, initiator of the PoolA and PoolB will be a system account instead of the user who start “launcher” process.

ok, i will try that, thank you for your help.