The recordCreateDefaults field of CreateDefaultsConnection type returns default field values for a new record of a given object type. The response includes the pre-populated field values that a user sees when opening a blank create form in the Salesforce user interface. This feature mirrors the behavior of the UI API Get Default Values to Create a Record and Get Default Values to Create a Record—Lightweight resources. If you need object info or layout structure, chain separate calls to objectInfo and recordLayouts to get everything necessary to render a pre-populated create form.
Pass recordCreateDefaults in the uiapi field. For example, use objectApiName: "Account" to return the default field values for a new account record.
The recordCreateDefaults type has these arguments.
objectApiName - The object API name of a supported object. This argument is required.
recordTypeIds - A list of record type IDs. If unspecified, returns defaults for all accessible record types. Specify either recordTypeIds or configs.
formFactor - Default form factor that the FormFactor enum provides for all layouts. Default value is LARGE. This argument is ignored when the mode value is TEMPLATE.
mode - The mode that the CreateDefaultsMode enum provides. Controls whether to return all CREATE layout fields (LAYOUT) or only requested fields (TEMPLATE). Default value is LAYOUT. To discover which fields appear in LAYOUT mode, get object layouts with mode: CREATE.
configs - An array of CreateDefaultsConfig types with these arguments to request different form factor combinations per record type. Specify either configs or recordTypeIds.
recordTypeId - A record type ID. This argument is required.
formFactor - Form factor that the FormFactor enum provides for the record type. Default value is LARGE.
optionalFields - A list of additional field API names to include in the response alongside the fields determined by mode. Useful when mode is TEMPLATE to specify exactly which fields to return.
first - Number of results per page. Default value is 10.
after - Returns the results after the given cursor. See Paginate Results.
CreateDefaultsConnection Type
The CreateDefaultsConnection type represents a result set of record create defaults that ties together the defaults and page info. Results are paginated by record type, with each edge representing one set of defaults for one record type. See Paginate Results.
Most FieldDefaultValue member types implement the FieldValue interface and expose a value field and a displayValue field. Use inline fragments to query type-specific fields. For example, ... on StringValue { value displayValue }. See Fields for more information about Field Value types.
FieldDefaultReferenceValue Type
The FieldDefaultReferenceValue type is the resolved reference record info for a relationship traversal field, such as owner or parent.
The FieldDefaultReferenceValue type contains these fields.
id - The ID of the referenced record.
displayValue - The display name of the referenced record.
objectApiName - The object API name of the referenced record’s type.
PageInfo Type
The PageInfo type contains relative position information, which shows where in the entire result set the current page is located. The PageInfo type is the same for every Connection type. See PageInfo Type.
Enumeration Types
The recordCreateDefaults type has these enumerations.
CreateDefaultsMode
The CreateDefaultsMode enumeration controls which fields are returned.
CreateDefaultsMode Enum
1enum CreateDefaultsMode{2 LAYOUT3 TEMPLATE4}
LAYOUT - Returns all fields from the object’s CREATE page layout. This is the default.
TEMPLATE - Returns only the fields specified in the optionalFields argument.
FormFactor
The FormFactor enumeration specifies the layout display size. Use the LARGE value for desktop, the MEDIUM value for tablet, and the SMALL value for phone. See FormFactor.