Advanced filtering: Difference between revisions
No edit summary |
No edit summary |
||
| Line 13: | Line 13: | ||
After you save the form, publish the project and attempt to choose the Primary Contact for an Account, you can only choose from the filtered selection displaying the Account’s contacts, not all contacts. You still have the possibility to change the Lookup view to the default one with all contacts, unless you disable the Default View on the Primary Contact properties. | After you save the form, publish the project and attempt to choose the Primary Contact for an Account, you can only choose from the filtered selection displaying the Account’s contacts, not all contacts. You still have the possibility to change the Lookup view to the default one with all contacts, unless you disable the Default View on the Primary Contact properties. | ||
== Alternative: add filter to existing view == | |||
As an alternative to creating a completely new view, you can also reuse an existing view and add a custom filter that will be used only in this context. If the existing view also includes a filter, both filters apply. | |||
# Add the field Primary Contact to the account form. | |||
# Double-click the field and click '''Edit Filter'''. | |||
# Add the necessary condition. | |||
[[File:Adding filter to lookup view.png]] | |||
Both solutions are valid. | |||
* When you create a custom view, you have the benefit that you can create a custom style/format of the view; perhaps omitting fields that are unnecessary in the context of the lookup. You can also make all your lookup views have the same distinct style. | |||
* Adding a filter to an existing view is a simpler and faster way, albeit without the style/format option. | |||
[[Category:Woodford]] | [[Category:Woodford]] | ||
Revision as of 07:30, 13 July 2020
A filtered lookup is a view that is available from the form of another entity and displays related records. Let’s say that you want to add a primary contact field on the Account form and want to be able to choose from the contacts that belong only to the specific Account, instead of from all contacts.
- Enable the Primary Contact field on the Account entity. See managing fields for instructions.
- Create a new view of the type Lookup List for the Contact entity. See creating a view for instructions.
Let’s name it “Account’s Contacts”. You can also check the Hidden option, so that it is not shown in the view selector in the Mobile CRM application. Add any desired fields to the Primary and Secondary fields. - Click Edit Filter to open the Filter editor.
- Click Add Condition.
- Select Customer as field.
- Select Equals as operator.
- Click Variable and select the Account entity and the Id field.
- Click OK, then click Save & Close to close the filter editor.
- Open the Account’s form and add the Primary Contact field to the form. See adding fields for instructions.
- Select the new field and click Properties. On the Lookup Views pane, enable the new lookup view and make it the default view.
After you save the form, publish the project and attempt to choose the Primary Contact for an Account, you can only choose from the filtered selection displaying the Account’s contacts, not all contacts. You still have the possibility to change the Lookup view to the default one with all contacts, unless you disable the Default View on the Primary Contact properties.
Alternative: add filter to existing view
As an alternative to creating a completely new view, you can also reuse an existing view and add a custom filter that will be used only in this context. If the existing view also includes a filter, both filters apply.
- Add the field Primary Contact to the account form.
- Double-click the field and click Edit Filter.
- Add the necessary condition.
Both solutions are valid.
- When you create a custom view, you have the benefit that you can create a custom style/format of the view; perhaps omitting fields that are unnecessary in the context of the lookup. You can also make all your lookup views have the same distinct style.
- Adding a filter to an existing view is a simpler and faster way, albeit without the style/format option.
