Creating a new relationship

To create a new relationship, use the following steps:

  1. Open Studio and in the Create Application File wizard, select Data Model | Relationship:
  1. Now, fill in a new record form in the relationship table, as shown in the following screenshot, with the following values:
    • Name: Booking requests by same caller
    • Applies to table: Booking Request
    • Queries from table: Booking Request
    • Query with: (Use the following mentioned script)
  1. Populate the Query with field with the following script:
        (function refineQuery(current, parent) { 
 
          current.addQuery("u_caller", parent.u_caller); 
 
        })(current, parent); 

The Query with field executes on the server side and has access to all server-side Glide APIs. It also has two special objects named current and parent. The current object is a GlideRecordreference to the table specified in the queries from the Table field and is used to retrieve the list of records displayed in the related list. The parent object, on the other hand, is a reference to the record being displayed on the form. The preceding script is going to add a filter to the current GlideRecord object to retrieve and show records that belong to the same user. Now, click on the Submit button to define a new relationship.

The relationship will add a related list to the table it is applied to, which in our case is the Booking Request table. However, to show a related list in the form, we need to configure the related list to the form view.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.48.135