CreateAction is an action that supposed to be used in DataGrid (or in general in components based on ListDataComponent interface). It requires to know to which component action is assigned. So you see an error if “target” (DataGrid) is not set.
If you want to open the “detail” View to create a new instance of some entity, use ViewNavigators :
Hi, how do i use an action on a detail page? I want to make a ResetPassword button on a profile page, which will call the resetPassword action for the logged in user.
The sec_resetPassword action that you can see in user-list-view.xml can be used only inside a DataGrid. But you can copy the logic of this action to build a predefined ResetPasswordView. For instance:
@Autowired
private DialogWindows dialogWindows;
@Subscribe(id = "resetPasswordBtn", subject = "clickListener")
public void onResetPasswordBtnClick(final ClickEvent<JmixButton> event) {
DialogWindow<ResetPasswordView> dialog = dialogWindows
.view(this, ResetPasswordView.class)
.build();
ResetPasswordView view = dialog.getView();
view.setUsers(selectedUser); // or use CurrentAuthentication or CurrentUserSubstitution
dialog.open();
}
If you want a custom dialog, inject UserManager bean. It has resetPasswords() and changePassword() methods.