Lookups on Card Pages
A lookup on a card page gives you the ability to simply select a value from a list instead of typing it in. Typical scenarios from Microsoft Dynamics NAV 2015 are code fields that have a very short name only. It requires a description to understand its value. Furthermore, lookups might speed up the input process significantly.
Contrary to Microsoft Dynamics NAV 2015, Anveo Mobile App does not have an automatism to activate a lookup on a field. This allows a much more flexible configuration. It is put together of three basic components: Button on a card page to open the list view, Anveo Page of type list to show the lookup values and an Anveo Script to save the selected value in the record.
Anveo Mobile App provides an example on Anveo Page ASLS_CUSTOMER with a lookup to salespersons using Anveo Page Anveo Page ASLS_SALESPERSON_LU.
1. Create new Anveo Page of type list
The first step is to create a new list page that shows your lookup screen (see here). This Anveo Page can be used for lookups only, but you can add menu entries for further navigation if required. Example Anveo Page is ASLS_SALESPERSON_LU.
2. Open lookup Anveo Page via button
In the second step, add a button on your card page using an Anveo Script code to open your lookup Anveo Page. Add a Button to your Anveo Page (see here). Because you might already have a global table relation between the two records of source and lookup Anveo Page (see here), the lookup Anveo Page must be opened via Anveo Script without any filters. Add a new Action Code and assign it to your button (see here). The following Anveo Script code opens your Anveo Page without any filters:
Example see Anveo Page ASLS_CUSTOMER , Action Code ASLS_OPN:PAYTERMS_LU.
3. Action Code on your lookup Anveo Page
Last step is to add a new Action Code that is run on Mobile Shortpress event (see Short Press Action). It saves the selected value to your source record srcRec in the card and closes the lookup Anveo Page.
A lookup Anveo Page can be used multiple times for different source tables. In this example, you can use the Anveo Page also for a lookup on the sales header or contact. Simply add new source tables the last Anveo Script. In srcRec you know from where the Anveo Page was opened.
In some scenarios a lookup Anveo Page is opened from different fields but from same table. Then, the last write-back Anveo Script does not know where to write the data to. It requires additional code.
Option 1: use multiple lookup Anveo Pages.
Option 2: Remember the source field in table ACF Lookup Helper like a global variable and use it when writing back into the source table.
Example: Sell-to Customer No. and Bill-to Customer No. lookup in table Sales Header.