How to show some default values

How to show some default value at the create screen of edit screen. I want to show today date to date column and some values to another columns at the time of opening ( while pressing Create button ) ?

Hi, you could make this in Entity Attributes.

For example: if you like to add the actual date in field, in Source of the entity add:

@Temporal(TemporalType.DATE)
@Column(name = “FECHA_ALTA”, nullable = false)
protected Date fechaAlta = new Date();

See also Assigning Initial Values.

Hi,
Thanks your support. But how to edit the source of entity, I tried but it is read only , cant change anything in source.
Sorry , I am a newbie …

You can use Intellij Idea, and then edit from the Ide:

https://doc.cuba-platform.com/manual-6.2/ide_integration.html

When, you clic on IDE button of the entity, it’s opens automatically on IntelliJ.

Have a nice day!

Ok, now I got the idea. Thank you. One more question, how to change the User creation screen ? I want to add 2 columns in to that screen to save branch code with user master. How it can done ?

Hi, you need to create your table, and then make a relation to table Users.

After that, you go to Screens, add, and extens existing from base.

Here, are all screens of the system, then you need to modify Datasources ans views to select the new fields.

I mind that you cannot edit Entity Users directly.

I got something but not fully. How to make relation to table users ? how to modify datasources ? Sorry for my ignorance…

Hi, have you make’t any little project lije that?

https://www.cuba-platform.com/quickstart
or
https://www.cuba-platform.com/system/files/CUBA-Hands-on-Lab.pdf

In their examples, exists how to make relation between entities, when you make any relation can you select user Databse too.

I’ve attached an screen shot.

User relation

Actually my requirement is that to add an extra column (or field) (for example BranchName ) to user entity. If I cant modify the user entity , how can I do these things in another way ? I want to add a branchname into the new user creation screen just below the Active check box .
Pardon me , I am a newbie…

Simply create a new Entity (UserAddValues) to your project, with fields you desired, and then created as Sendid Image, a new Relation between Users and your table.

When you Save, you can Edit User Edit Screen (is same as new user), and modify to add the fields as you have been created.

Ok, I think it will solve the problem. I will try it. Thank you very much for your support.

Manoj,

Please, have a look here.

Regards,
Aleksey