Skip to content

Survey Record Types

Shun Kosaka edited this page Nov 17, 2023 · 11 revisions

Prerequisite (How Salesforce Works)

  • RecordTypeId system field is not accessible when there's no active record types.
    • Master record type is always active.
  • RecordTypeId can be null even if there're active record types. (e.g., Create records before creating the record type)
  • Whether or not the record type is active doesn't control the record visibility directly.
  • Whether or not the record type is available for the profile doesn't control the record visibility directly.
  • If the record type is not available for the profile, the user cannot create the new record. (INVALID_CROSS_REFERENCE_KEY error throws)

Expected Behavior

Record Type Selection Screen

  • If there's no record type in the Survey object, survey type selection screen should be skipped and master record type id is automatically set.
  • If there's single record type in the Survey object, survey type selection screen should be skipped and its record type id is automatically set.
  • If there's multiple active record types in the Survey object, survey type selection screen shows them except for Master, and then selected survey type should be passed to the survey editor screen.

Survey List Screen

  • Past surveys with inactivated record type should be displayed too. (even if the record types are not displayed in the survey type selection screen)
  • If the selected record type is not assigned to the integration user's profile, a proper error message should show when uploading

Design and Implementation

Record Types

  • All the record types in the org should be retrieved, including master and inactivated record types. (See source code)

Records

  • RecordTypeId field must not be contained in SOQL when there's no active record types. (See source code)
  • RecordTypeId field must not be contained in POST request body when there's no active record types. (See source code)
  • If RecordTypeId of the retrieved records are null, the mobile app should set the Master record type Id, to resolve the page layout Id and show the record detail screen. (See source code)
Clone this wiki locally