Is it possible to update display name of an opened task via groovy script?

I am writing an extension Rest API to let administrator member to update some task's value if needed.

Currently, there will be 2 values that should be able to change by admin: due date and display name.

As I check BonitaSoft API, I found method "updateDueDateOfTask" for due date.

For display name, I cannot find any specific method for it.

I also not found no method to update task's value, but found a method "processAPI.getActivityInstance" to get those value for viewing.

Does BonitasSoft API not allow to change task's display name?

Hi,

No, it isn’t supported. You may create a ticket in the bugtracker with your request and use case, it may be added in future version :slight_smile:

HTH
Romain

@romain.bioteau: Thanks for reply. I guess I will try to do a workaround with task's variable.

As for business data (contract input that user input on screen), the diagram I am doing should allow user to submit a json file export from another system to update instead of go to a screen.

I plan to write a Rest API to handle the json data that this another system can call and send json string.

I check the Bonita Groovy API from [ProcessAPI] but cannot find the method to do update business data. Is this also not allowed to do from API?

Be careful, Business data and Contract input are 2 different concepts.

In order to update/create/delete Business data you need to use a process. There is no API to directly manipulate them, it must be driven by a process.

HTH
Romain

@romain.bioteau: Thanks for reply. I need to update user's input which I believe to be "business data".I guess that I will need to use query to update it.

On the side note, I am trying to connect the studio with the new PostgreSQL DB instead of the current default H2 to be inline with production environment. I have updated "database.properties", run "setup init" and "setup configuration" from tomcat. The new 2 table business_data and bonita_journal were created in new DB. However, when trying to deploy BDM, I got "UndeclaredThrowableException". I wonder what did I miss?

I need to update user’s input which I believe to be “business data”.I guess that I will need to use query to update it.

business data are meant to be persisted by the processes. There is no “write” query possible. You have to use task operations to update business variables.

I am trying to connect the studio with the new PostgreSQL DB instead of the current default H2 to be inline with production environment

It is not supported and not recommended. Some features are coupled with the usage of h2 in the Studio.
The setup tool will be remove in future version to avoid the confusion. Using h2 with the PostgreSQL Compatibility Mode could be an option in the future to fill the gap.

@ romain.bioteau: I understand that update data with query outside of the system is not a good idea, but my current task is to see if it is possible with Bonita's Rest API. I have found an example code that allow to connect to DB and select data from [rest-api-sql-data-source] on GitHub.

Is it the limit of what Bonita allows to do? Can I use this code and run an update query?

This code is an example of how to use a jdbc connection to make a query. The idea of the exemple is show how to perform jdbc query on a an external system. Business data datasource is not considered external. We use shared transactions between the business data database and the engine database and we (the runtime) want to keep the control of how the data access is done.

You can run a jdbc query against your business data table, however, if you do that, you won’t be sure that the data is consistent. That’s why we advise against it.

We have no rest api to update business data directly.
You must design a process that take a business data in input, do the update using operations and then you can start it using the rest api.

HTH
Romain