How to store Business Data Object into Database (groovy/java)

For example I have business data object Cup.

I can define it on Groovy script easily.

def new_cup = new Cup();
new_cup.name = "Tiny Cup";
new_cup.description = "Nice tiny cup";
new_cup.ownerId = 5;

But how I can store it into database programmatically now?

Hi,

Business data write operations can only occurs using tasks operations or default value expressions.

HTH
Romain

Hello

You need to create a Business varialble of the Table that you want to work with.

Either , you can write the above script in the Initialize section of the Business variable.
Or
In a Human Task or Service Task ->go to Operation -> Add -> map business Variable on left side and add your script on the right hand side.

You must create a Business variable first and all database transaction must happen through operation section on Task

Regards

 

Thank you for response.

Sadly your answer does not show how to add data programmatically. 

I'm interested how to add data programmatically. not via Forms, etc.