I have a problem very similar to this one (and many other related posts), but I would like to pass an entity through a standard action.
I have a Customer editor screen with a table opening a Contact lookup screen through the standard action “add”. I would like to pass the Customer currently being edited to the Contact lookup screen in order to add optional filtering on the Customer Contacts.
I customized the query in the Contact lookup screen in order to handle it.
<query> <![CDATA[select e from busy$Contact e]]> <filter> <or> <c>e.customer = :custom$customer</c> <c>e.customer is null</c> </or> </filter> </query>
Now I need to pass :custom$customer to the lookup screen. For now I discarded these solutions :
- inject “contacts.add” action, then setwindowsParams(…) in Customer editor postInit() method, because this is static (what if Customer changes ?)
- create a custom ‘add’ action and a custom Contact browser (the default ones fit me well apart from that)
EDIT : I gave a try to the first solution (and jpql tweaks) and it works. If I understand correctly postInit() is called each time the edited entity changes so it seems my case is fulfilled, right ?
Ideally I would like to set the Customer param at the moment the standard ‘add’ action calls ‘openLookup’ to be sure the Customer entity sent to the Contact browser is current and will not change (especially when a modal dialog is used).
In fact, the point is very similar to the ‘screen manipulation’ sample, but it uses code to open the Product lookup, which I do not.