Declarative UI and onCreate method

42 views
Skip to first unread message

Francis Augusto Medeiros-Logeay

unread,
Aug 18, 2025, 4:09:03 AMAug 18
to Keycloak User
Hi,

I am using declarative UI - which is an amazing tool, btw.

My question is: is there a way to add computed values to the ComponentModel? For example, to have something on the onCreate or onUpdate methods that would put another value on the model?

I tried, but it didn’t get persisted, which gives me the impression that the values can only be updated via form submission, but not programatically.

For example:

@Override
public void onUpdate(KeycloakSession session, RealmModel realm, ComponentModel oldModel, ComponentModel newModel) {

MultivaluedHashMap<String, String> cfg = newModel.getConfig();
cfg.putSingle("user", "jones");
newModel.setConfig(cfg);
}

It doesn’t work. I tried that with and without creating the property first.

Best,
Francis
Reply all
Reply to author
Forward
0 new messages