rodriggj / saleforce_dev

0 stars 0 forks source link

4. Adding Custom Fields to Car Object #13

Closed rodriggj closed 2 years ago

rodriggj commented 2 years ago

Here we will use the Salesforce Object Manager service to create the Schema of the Car custom Object.

The fields we will add are depicted in the picture. Use the picture for appropriate configuration details.

rodriggj commented 2 years ago
  1. In the Salesforce Org, go to Setup / Object Manager / Car / Fields & Relationships
  2. Salesforce creates a set of Default Fields for each Custom Object. Here you can see the fields Salesforce created for you:
    • Car Name
    • Created By
    • Last Modified By
    • Owner
  3. In addition to these fields we will add our own custom fields specified in the diagram above. To start this process you will navigate through a Field Creation Wizard. I will explain a single example simply repeat the process for all fields required.
rodriggj commented 2 years ago

Process:

  1. We will create the Category field. Start by clicking New button
  2. Under Step 1. Choose the field type, select Picklist, click Next
  3. Under Step 2. Enter the details,
    • At Field Label field, type Categories
    • At Values select the Enter values, with each value separated by a new line radial button.
    • In the Text Box that appears when clicking this button enter the list of values for the picklist enter a new line for each value (Hatchback, MUV, Sedian, SUV)
    • At Required check this box.
    • Click Next
  4. Under Step 3. Establish field-level security, these are Roles that you can specify visibility permissions. We only have the System Administrator role for our App so we need this to be checked and by default it should be, so leave the defaults and click Next
  5. Under Step 4. Add to page layouts, the default should be Car Layout which should be checked , click Save
rodriggj commented 2 years ago

We have 2 other picklists beyond the Categories example above. This is for fields Control & Make

Control

Make

rodriggj commented 2 years ago

rodriggj commented 2 years ago

If you no go to the Car Hub app via the App Manager select the Cars Tab, and click New you will see a modal display with a layout for adding a new Car record.

rodriggj commented 2 years ago
  1. Go to Setup / Object Manager / Car / Page Layout / Car Layout
  2. Drag and Drop fields to your liking and click Save

rodriggj commented 2 years ago

Now if you want you can go to your Car app and you should be able to click new and see your new modal with your Page Layout configuration.

NOTE: This maybe the first time that you begin to see an issue with Salesforce Lightning Web Components, which is Cache. Salesforce as a Platform will Cache Page Objects, Layouts, etc. Often you must click the Refresh button for changes to take effect. Also it is commonly reported that you need to complete a Hard Refresh or utilize Incognito mode to avoid cache issues. This comes with additional unintended consequences and odd behavior.

REFERENCE: How To Fix The Caching Problem In Salesforce Lighting Component