I have an object in my bdm named "product" that have the attribute "name" I want to add constraint to this input that must be unique, Can someone help me with groovy expression:
- How to get the object "project" with the groovy expression and search in the attribute of this object if the input value already exists?
You can’t implement this constraint at contract level, but you can instead use a unique constraint on the Business Object:
In the BDM editor, you can navigate to the unique tab and select the name attribute for the Product object.
It will generate a query for this object that can used in a web page to validate that a given product does not already exist. ../API/bdm/businessData/com.company.model.Product?q=findByName&f=name={{product.name}}&p=0&c=1
The above query will return an empty array if the product does not exist.
If despite the UI validation, a contract is sent server side and the product name already exists, the task execution or process instantiation will fail due to the unique constraint in the BDM.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.