Oracle CRM On Demand Desktop Customization Guide > Adding Custom Fields to Oracle CRM On Demand Desktop > Process of Adding Book Support to a New Top-Level Object >

About Book Prefilling


Prefilling is the process of automatically assigning predefined values to certain fields when a new record is created. Default values or functions that calculate default values must be linked to the fields that users want to have prefilled when they create a new record. This linking is specified in the business_logic.js file. In this example, the Book Name field is automatically prefilled with the value Book_12... after an Opportunity form is opened. For instructions to configure Oracle CRM On Demand Desktop so that when a user creates a new record, the default book is automatically added to the book for the field displaying the record, see Setting Up Books for Oracle CRM On Demand Desktop Objects.

The following line links the BookId field with the prefill_book function that returns the ID of the book to prefill the field.

scheme.objects.get_object("TypeName").get_field("BookId")["initial_value_fn"] = prefill_book;

The algorithm implemented in the function is as follows:

  1. Get the book that a user has selected on the Record Set tab on the Synchronization Control Panel.
  2. If the user did not select a book, then get the book that is set as the default for the object type from the ::DefaultsTypeDefaultBookPicklist picklist. This picklist sets the default books for object types.
  3. If the book is not available; that is, there is no default book for the record, then get the book that is set as the default for the current user regardless of the object type from the ::DefaultsBookPicklist picklist. This picklist sets the default book for users.

    If the default book for the user is not available, then do not return a value, and the Book Name field is not prefilled.

  4. If the book ID is obtained from any of the preceding steps, then check whether the book can contain values or whether the book is only a container for other books. Return the book's ID if the book can contain values, or do not return any ID if the book is a container.

To set up default book prefilling, see Prefilling the Default Book on New Records.

Oracle CRM On Demand Desktop Customization Guide, Version 5.2 Revision A Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.