IllegalStateException: Current item is null

Hello,
It should be considered that getItem() returns a value only after screen is initialized with setItem() method. Until this moment, this method returns null, for instance when calling from inside init() or initNewItem().
Do you have an example please how can I set an item in Cuba7 (in current Edit Screen), in order to use it under onInit event?

oganizationDc.setItem(//what? - current edited Organization);

Any news here,pls?

Hi,

Can you please elaborate are you talking about new screen API (StandardEditor) or the old one (AbstractEditor)? Also, source code and stacktrace would be very helpful.

Hi,

I’m talking the new screen API (Standard Editor) - Cuba 7.

First of all, InitEvent is sent too early - there is no entities loaded at this moment.
Try to use getEditedEntity() in the AfterShowEvent listener - it returns the entity being edited.

I already did.
Gleb helped me.
Thank you!