Skip to main content

Create Formula Fields

Add a Static Resource

Next, you create a field on the Travel Approval object that shows a visual indicator (that is, image file) based on the value of the Status field. For example, one image displays for Rejected approvals and a different image for Approved approvals. This provides a quick and simple way for users of the system to get an indicator of the status of a travel approval.

First, we need to upload a zip file to your Salesforce environment that contains all the images we use. You should have a file titled StatusImages.zip that is part of the project files you downloaded at the beginning of the project. We now upload that zip file as a static resource file in Salesforce.

  1. Click the Home tab to navigate back to the main setup page.
  2. Click Custom Code | Static Resources (or enter Static in the Quick Find to filter down the options).
  3. Click New.
  4. Enter the following values for your static resource:

Parameter

Value

Name

StatusImages  (Important: there are no spaces, and the S and I are capitalized)

File

StatusImages.zip

Cache-Control

Public

Here's what the it should look like: 

Static Resource Edit with Static Resource Information

5. If everything looks good, click Save

Add a Field

Next, create a new field on the Travel Approval object to show an image based on the Status field. Salesforce has a formula field data type that can be used for this.

  1. Click the Down icon. icon next to the Object Manager tab. This provides a shortcut to the Object Manager for the recent objects you have edited.
  2. Select Travel Approval
    Object Manager page with Travel Approval selected
  3. Select Fields & Relationships.
  4. Click New
  5. Select Formula data type.
  6. Click Next.
  7. Enter the following values:
    1. Field Label: Status Indicator
    2. Field Name: Status_Indicator (This automatically gets sent when you tab out of the Field Label field)
    3. Formula Return Type: Text
  1. Click Next.
  2. Copy and paste the following formula into the formula editor.
IF( ISPICKVAL( Status__c , 'Approved') , IMAGE("/resource/StatusImages/thumbs-up.png", "Accepted", 20, 20),

IF ( ISPICKVAL( Status__c , 'Rejected'), IMAGE("/resource/StatusImages/thumbs-down.png", "Rejected", 20, 20),

IMAGE("/resource/StatusImages/draft.png", "In-Process", 20, 20)))

10. Click Next, Next,Save.

Congratulations, you now have a new field Status Indicator setup on your Travel Approval object. In the next step, you learn how to automate your application with Flow Builder.

無料で学習を続けましょう!
続けるにはアカウントにサインアップしてください。
サインアップすると次のような機能が利用できるようになります。
  • 各自のキャリア目標に合わせてパーソナライズされたおすすめが表示される
  • ハンズオン Challenge やテストでスキルを練習できる
  • 進捗状況を追跡して上司と共有できる
  • メンターやキャリアチャンスと繋がることができる