Business data records not created in DB

1
0
-1

Create "my first process" in Bonita.
Create it similar with Getting started tutorial:
user fill application form with 3 fields and other user can fill "Approve" field.
Process run successfully, first form appeared. I fill it, second form appeared too, I fill Approve field, submit. All work.
But I haven't any changes in Business data database. Entered data don't appeared there.
I'm absolutely confused: where find a error.

Comments

Submitted by PaSol on Tue, 06/26/2018 - 12:24

When I try to look context of case a see

Context: {"computerData_ref":{"name":"computerData","type":"com.company.model.Computer","link":"API/bdm/businessData/com.company.model.Computer/","storageId":null,"storageId_string":null}}
I don't understand why "storageId" and "storageId_string" are null?

Submitted by pierrick.voulet on Wed, 06/27/2018 - 21:22

It looks like the business variable value on your case is not initialized at the time of this REST API call. Are you sure that your "computerData" process business variable initialization expression returns a valid Computer typed value?

Submitted by PaSol on Wed, 06/27/2018 - 22:28

I'm not sure, absolutely. I create this process seems to Getting started tutorial, try to repeat all steps but for another business data structure. How I can check initialization expression?

Submitted by pierrick.voulet on Thu, 06/28/2018 - 00:15

you can select your process on the whiteboard, select the "Data/Pool variables" tab from the bottom panel, double click on the business variable "computerData", a "Edit Business variable" dialog should now be opened, click on the pencil icon next to the "Default value" expression, you can now use a Script (GroovyScript) expression type and write some code to return the Computer typed value you want.

Optionally, you could also use this expression to retrieve an existing Computer typed value that already exist in the BDM, check ComputerDAO methods to do so.

Submitted by PaSol on Thu, 06/28/2018 - 17:11

I recreate Contract and leave Radio Button on Auto create initializing script and data begin created in DB.

Submitted by PaSol on Thu, 06/28/2018 - 19:14

Optionally, you could also use this expression to retrieve an existing Computer typed value that already exist in the BDM, check ComputerDAO methods to do so.

Sorry for stupid question, but where I can check ComputerDAO methods? I don't find any detailed explanation for DAO methods.

Submitted by pierrick.voulet on Thu, 06/28/2018 - 19:31

Yes, the auto create initializing script does what I suggested you to do manually. The only catch is that you do not want to regenerate the contract each time so you can also edit the script manually in case of future iterations of development. You can check the content of the script to better understand how to return such instance from a Groovy Script expression.

Regarding the Data Object Access (DAO), Bonita provides an accessor for each type of data you defined. In your case you have a type "Computer" so in Groovy Script you should have access to a variable called "computerDAO" in Groovy Script expressions. You could use auto-completion (put your cursor right after the variable name in a Groovy Script expression and CTRL + SPACE) to have a list of all methods that can be used to request data from this type from the BDM. You should find at least findByPersistenceId as any type has a persistenceId attribute.

Submitted by PaSol on Thu, 06/28/2018 - 20:00

Thank you very much!

No answers yet.
Notifications