How do i set the Dynamic Attributes & Access Group Constraints to load in default

Hi,
I want to set some Dynamic Attributes & some Access Control Contraints (which i was created), And i want to load those value by default. Currently, when i create database in Cuba Studio, the inserted value are all deleted (as expected). So, i wanted to load those default value in INIT DATA(in DATABASE SCRIPTS). Please guide me to insert the default value in the CategoryAttribute, CategoryAttributeValue & Constraint table via INIT DATA in DATABASE SCRIPTS.

Thank you

Hi,

You can create dynamic attributes & access control constraints in the UI, as you used to do, then right-click on the record > System attributes > Script for insert:
image
Copy and paste the script to 30.create-db.sql file (see Creating the DB Schema).
Do the same for the nested entities, for example:

insert into SYS_CATEGORY 
(DISCRIMINATOR, ID, VERSION, CREATE_TS, CREATED_BY, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, NAME, ENTITY_TYPE, IS_DEFAULT, LOCALE_NAMES, SPECIAL) 
values (0, 'f4b41100-99bc-7469-d3bd-fbdf51ee7291', 2, '2018-10-29 12:09:57', '1', '2018-11-19 12:15:27', 'admin', null, null, 'ClientCategory', 'workshop$Client', null, null, null);

insert into SYS_CATEGORY_ATTR 
(ID, VERSION, CREATE_TS, CREATED_BY, UPDATE_TS, UPDATED_BY, DELETE_TS, DELETED_BY, CATEGORY_ID, CATEGORY_ENTITY_TYPE, NAME, CODE, ENUMERATION, DATA_TYPE, ENTITY_CLASS, DEFAULT_ENTITY_VALUE, DEFAULT_STR_ENTITY_VALUE, DEFAULT_INT_ENTITY_VALUE, DEFAULT_LONG_ENTITY_VALUE, ORDER_NO, SCREEN, REQUIRED, LOOKUP, TARGET_SCREENS, DEFAULT_STRING, DEFAULT_INT, DEFAULT_DOUBLE, DEFAULT_BOOLEAN, DEFAULT_DATE, DEFAULT_DATE_IS_CURRENT, WIDTH, ROWS_COUNT, IS_COLLECTION, WHERE_CLAUSE, JOIN_CLAUSE, FILTER_XML, LOCALE_NAMES, ENUMERATION_LOCALES) 
values (newid(), 1, '2018-10-29 12:09:57', '1', '2018-11-19 12:15:27', 'admin', null, null, 'f4b41100-99bc-7469-d3bd-fbdf51ee7291', 'workshop$Client', 'Premium', 'premium', null, 'BOOLEAN', null, null, null, null, null, 1, null, false, false, 'workshop$Client.browse,workshop$Client.edit', null, null, null, true, null, null, null, null, false, null, null, null, null, null);

Next time you run gradle createDb, the database will be filled with your initial data.

Thanks @shiryaeva
It works as expected…