Creating custom objects in Salesforce

You can create custom objects and fields in Salesforce for your Skedulo managed package to include information and data beyond the defaults provided by Skedulo. Custom objects are often required by users wanting to create custom connected pages to display data or create custom interfaces for their organization.

This section uses the GroupEvent custom object example to walk through the following steps:

It also includes a procedure to create the Attendee custom object, which is required in the most common use case for the GroupEvent object.

Creating a custom object in Salesforce managed package

When you create custom objects in your Skedulo managed package in Salesforce, you must map the custom objects and fields in your Skedulo web application. Mapping objects and fields in your web application adds your custom objects and fields to the GraphQL schema, which is required for generating custom connected pages.

  1. Open the Skedulo managed application in Salesforce.
  2. Click the Settings cog in the upper-right corner and select Setup,
  3. From the menu bar on the left, open Platform Tools -> Objects and Fields -> Object Manager.
  4. Click Create in the upper-right, then select Custom Object.
  5. Type GroupEvent into the Label field, then type GroupEvents into the Plural Label field.

The Object Name and Record Name fields are pre-populated from the Label field, and these fields can be edited.

Click Save.

Adding custom fields to your custom object in Salesforce

After you have created your custom object in Salesforce, you can add custom fields and relationships for the information you want to appear on that object.

By default, all custom objects are given a unique identifier (UID), which is a unique ID string used to to run queries and return data.

Objects must also have a Name field, which you will need to add to the object using a custom field.

Name is the natural key for an object and is used to display a record in all cases beyond standard objects. An object without a Name field cannot be used in a Lookup Relationship with another object as the record is not easily recognizable.

The Name field can be a string or a number data type. In Salesforce, you have the option to create a Name field with the Auto Number data type, which provides an incrementing number with an optional custom prefix to each object that you create.

  1. In the Object Manager for the GroupEvent object, click Fields & Relationships in the menu on the left. This page shows the fields that are currently set on the GroupEvents object. Click the New button in the upper-right to add a custom field.
  2. Select the field type for the custom field you want to create. Select Auto Number from the list of data types and click Next.
  3. Type Name into the Field Label text box. This is pre-populated to the Field Name field.
  4. Add a Display Format for your Name custom field. The format uses a prefix followed by an automatically generated number. As this is a custom field for the GroupEvent object, this example will use the format GE-{000000}.
  5. Type 0 in the Starting Number field.
  6. Click Next when you have finished adding the field details.
  7. Set the field-level security settings that you require and click Next.
  8. Click Save.

For more information about mapping custom fields in the Skedulo web application, see Admin Settings: Custom Fields.

Creating the Attendee custom object with custom fields

The Attendee custom object is a requirement for the GroupEvent object, as we need to know who will be attending the group event. The Attendee object often includes fields such as Account or Contact details for billing and record-keeping purposes. This example provides basic instructions for adding a Name field and a lookup relationship to the GroupEvent.

You can add other custom fields as required.

  1. Open the Object Manager page in Salesforce under Setup -> Platform Tools -> Objects and Fields -> Object Manager.
  2. Click Create -> Custom Object to create a new object.
  3. Type Attendee in the Label field. This pre-populates to the Object Name and Record Name fields.
  4. Type Attendees in the Plural Label field, then click Save.
  5. In the Object Manager for the Attendee object, click Fields & Relationships in the menu on the left, then click New.
  6. Select Auto Number from the list of data types and click Next.
  7. Type Name into the Field Label text box. This is pre-populated to the Field Name field.
  8. Add a Display Format for your Name custom field. The format uses a prefix followed by an automatically generated number. As this is a custom field for the Attendee object, this example will use the format A-{000000}
  9. Select the Lookup Relationship relationship data type, then click Next.
  10. Select the GroupEvent object from the Relates To objects picklist to create a lookup relationship between the Attendee object and the GroupEvent object, then click Next.
  11. Complete any other relevant field information. Because we want the Attendee object to be a required field on the GroupEvent object, we are selecting the Required text box and choosing the option Don't allow deletion of the lookup record that's part of a lookup relationship. Click Next to continue.
  12. Select the relevant security settings, then click Next.
  13. Click Save to save the lookup relationship.

Last modified August 12, 2019: added custom api section (53f2c00)