How to modify the reference operations, when adding an entity

how to make a reference to an entity, that user cannot create new objects of the referenced type from here, but only selecting an existing entity.

Means, if you choose an entity in the form, it will open a screen with the entities, which are possible to choose. You can click on button “select”, create, remove. But I dont want the buttons “create” and “remove”, if user choose an value for the association.

Thanks

First, you can select from a drop-down list if you define an optionsDatasource for the picker field with reference entity.

Second, you can create a browse screen without Create, Edit, Remove actions and give it {entityName}.lookup identifier. Then by convention, it will be used instead of the usual {entityName}.browse screen for selecting entities in picker fields.

1 Like

Thanks @knstvk,

but I still dont understand it…:confused: Can you please give me an hint more?

Thank you

OK. Let’s take the Sales sample project.

Open an Order editor - you will see the drop-down list for selecting a Customer. This is because an optionsDatasource is set for the Customer field.

To create a separate lookup screen, do the following:

  • Select Customer entity and click New > Generic UI Screen.
  • Select Entity browser template, click Create. You will see the Resolve conflict window dialog, because a browser screen has already been created for this entity. Change customer-browse.xml to customer-lookup.xml, CustomerBrowse class to CustomerLookup and sales$Customer.browse id to sales$Customer.lookup, then click OK.
  • Close templates page and edit sales$Customer.lookup screen. Remove the buttons panel and actions from the table. Save the screen.
  • At this point, the sales$Customer.lookup will be opened from all lookup actions by default.

Thanks @knstvk!
It works :slight_smile:

But my problem now is…when I open my application, it shows me a “Lookup” Tab for this. How I can remove the loopup from tab? That it will be not shown, when I click on “application”.

Thanks a lot

Look at your main menu settings: Generic UI > Open web menu in Studio.

1 Like