Search This Blog

Thursday, January 24, 2013

Component Properties: Difference between Search Record and Add Search Record

Below are the Search records we can add through Component properties.

Search Record Name
 Displays the component's default search record when you access the component in update or display mode.

Note. You can assign an override search record to a component at the menu level. If the component uses an override search record, the search record displayed in the Override Search Record will be different from this one and you should search it instead.

Add Search
 Displays the component's search record when you access the component in add mode.

Source of above information: Peoplebooks

When to use Add Search Record?
 In a case where we want to control the data that should be added or for a requirement where we add a counter for the ID.

Lets see a simple example where the Search record and Add Search record is used.

The below Events page helps us to create different types of  Campus Events.

Let's first see how this page works.

Search shows us the list of Campus Events available.
Lets see the data for Event ID 000010005.

 Now, Lets Add a New Event ID. In this case , we use a different Search record because we need to setup a new Event ID.

  Lets see how we can do this in App Designer.

  Below is strucuture of these search records.
 The Standard Search record is a view which retrieves data from primary record of the component.
 For Add Search record, Primary record of the component is used. The EventID is set to '0'  at fielddefault peoplecode. Once the page is saved, the peoplecode in the SavePrechange event will get the most recent Event ID and then adds plus 1. (i.e if recent EventID is 121 ,then new Event ID will be 121 +1 = 122)

No comments: