Newly Created Child Entity Not Shown In Browser Screen

Dear Community,

I’m passing the parent entity (to use certain attributes on it in a calculation) to an editor screen for some filtering using screen builder in the add button click event shown below.

    public void onAddAssignmentBtnClick(Button.ClickEvent event) {
        Roster roster = getEditedEntity();"Roster: " + roster);
        screenBuilders.editor(ShiftAssignment.class, this)
                .withOptions(new MapScreenOptions(ParamsMap.of("roster", roster)))
                .addAfterCloseListener(e -> rosterDl.load());

However whenever I create the child entity it does not show in the browser screen for selection. But if I navigate to the parent entity editor screen and try to add a new child entity then the previously created child entity is now shown in the browser screen but not the newly created one.

It’s hard to say what’s going on without seeing the whole picture.
Could you prepare a simple example project with these parent/child entities and screens?


@knstvk Sorry for the delay in responding. Kindly see zip for your consideration. (918.0 KB)

Thanks for the test project.
Could you describe what steps demonstrate the problem? Like “do this, do that, see that’s wrong”. It would save us from wrong guesses.

@knstvk Steps

  1. Expand the Personnel menu section and create the following
  • Shift

  • Client (should add a location)

  • Personnel (should choose Guard as personnel type)

  1. Expand Payroll menu section and create a personnel role for a Guard

  2. Navigate to the Roster menu under Personnel section and create a roster

  3. Select the Add button to create a assignment for the roster

  4. Fill out the fields on the assignment screen then select Ok. You will then be redirected to the browser screen of the assignment. It is at this point the newly created assignment disappears i.e. do not show up in the list until you try to add another assignment where you see the previous assignment after creating the new one and selecting ok again

Thanks for the steps, I see the problem now.
But I don’t quite understand your intention - on one hand, you use “Add” action which allows you to select from a list of existing ShiftAssignments, from the other - you create a new ShiftAssignment right after user clicks Add.
If you really want to always create a new ShiftAssignment, and after saving it allow user to select from all ShiftAssignments, then define a custom action which first shows ShiftAssignment editor, and in its CloseListener shows ShiftAssignment lookup screen.

@knstvk I’m trying to past the new roster (unsaved) to the shiftassignment so that I can use certain attributes on it for some calculations…I will look into the custom action as you’ve suggested