Anvaigo Mobile App / Customize the User Interface / Flexible Relations Between Anvaigo Pages

Flexible Relations Between Anvaigo Pages

Normally Anvaigo Client Suite identifies the relation between two Anvaigo Pages using the table relations which are set up once globally for all Anvaigo Pages. This setup is done in ”Anvaigo. For example, the relation between the ”Customer” and the ”Sales therefore do not have to be set manually for every Anvaigo Page constellation as in Dynamics.

For more special scenarios in which the relationship between two tables is not to be created via the direct relation from field to field, a C/AL code can be deposited in the codeunit ”ACF function CustomAnvaigoPageRelation which sets the relationship manually. This makes it possible, for example, to output the related contact for a customer.

The relation described above is defined in C/AL code in the following code example:

// Show related company contact from customer
// Data Source: Customer
// Destination: Contact

// 1. Set table reference
RecRef.SETTABLE(Customer);
Mgt.OPENRecRef(DATABASE::Contact,DestRecRef);

// 2. Filter
ContBusRel.RESET;
ContBusRel.SETCURRENTKEY("Link to Table","No.");
ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Customer);
ContBusRel.SETRANGE("No.",Customer."No.");
IF ContBusRel.FINDFIRST THEN
Contact.GET(ContBusRel."Contact No.");
Contact.SETRECFILTER;
// 3. Copy Filters to DestRecRef
DestRecRef.SETVIEW(Contact.GETVIEW);
Source code of custom table relation between customer and his corresponding contact

You can lookup the source code shown above in the ACF Events Sales & Marketing, function CTR_CUSTOMER:CONTACT.

Creating a custom table relation is done according to the same scheme:

  • Convert record reference into a record; create a local variable and assign it (line 6).
  • Create the destination table as a local variable. The destination table has the type of the destination Anvaigo Page (in the example table Contact).
  • Transfer the filter to the record reference (line 17)

To use the custom table relation in the Anvaigo Web Portal a call to function CustomAnvaigoPageRelation is needed, using the relation code CTR_CUSTOMER:CONTACT:

CASE RelationCode OF
'CUSTOMER:CONTACT': "CTR_CUSTOMER:CONTACT"();
END;

The relation code CUSTOMER:CONTACT needs to be made public in the setup of the Anvaigo Client Suite and to be entered in the Anvaigo Page as individual table relation, so that the Anvaigo Client Suite uses the manually defined table relation instead of globally defined automatic table relations. The record used for filtering at Anvaigo Pages of type card is defined by the record displayed on the card; in Anvaigo Pages of type list the record for filtering is defined by the selected record.