Add custom fields to your custom object in Salesforce
After creating your custom object, you can add custom fields and relationships with other objects to enhance the information that appears on that object.
By default, all custom objects are given a unique identifier (UID), which is the string used to run queries and return data for that object.
Objects must have a custom Name field, which you need to add. 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 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 for each object that you create.
To add a name field to an object, do the following:
- In the Object Manager for the
Vaccineobject, click Fields & Relationships in the left-hand menu. A page showing the fields that are currently set on theVaccineobject displays. - Click New in the upper-right corner.
- Select the field type for the custom field you want to create. For this example, select
Auto Numberfrom the list of data types and then click Next. - In the Field Label text box, enter
Name. This is pre-populated in the Field Name field. - Add a Display Format for your
Namecustom field. The format uses a prefix followed by an automatically generated number. As this is a custom field for theVaccineobject, this example will use the formatVAC-{0000}. - Type
0in the Starting Number field and then click Next. - Select the field-level security settings that you require and then click Next.
Depending on your use case, it may make sense to add multiple fields. For the
Vaccineobject, it could make sense to addBrandandNumber of dosesfields. - Click Save.
Create relationships between custom objects
In our example use case, we would want vaccine records to be associated with jobs. To connect these two objects, you can use a custom field with a lookup relationship type. There could also be a requirement for a Supply object to provide the availability of a vaccine at a site. The Supply object could include fields such as Location or Count for ordering and record-keeping purposes. To achieve this, the same type of lookup relationship can be created between Vaccine and Supply objects as a field.
To add lookup relationships between custom objects, do the following:
- In the Object Manager for the
Vaccineobject, add another field with the data type: Lookup Relationship and then click Next. - Select the
Jobsobject from the Relates To objects picklist, and then click Next. - Click the Required text box and then click the option
Don't allow deletion of the lookup record that's part of a lookup relationship. This makes the field mandatory and protects the connection between the two objects. - Select the relevant security settings and click Next and then Save.
- Create a
Supplyobject with aNamefield in the same way you did for theVaccineobject. - Add another field with the data type: Lookup Relationship, then click Next.
- Select the
Vaccineobject from the Relates To objects picklist, and then click Next. - If you want the field to be mandatory, click the Required text box and then click the option
Don't allow deletion of the lookup record that's part of a lookup relationship. - Click Next.
- Select the relevant security settings and then click Next.
- Click Save.
Remember that objects and fields must be mapped in the Skedulo web application before they can be used in web extensions.
Related links
Mapping custom objects and fields
Admin Settings: Custom Fields.
Feedback
Was this page helpful?