Carry out the following steps to create a formula field to display a link to the filtered opportunity report:
- Click on the Setup gear icon in the top right-hand of the main Home page, as shown in the following screenshot:
- Click the Setup option, as shown in the following screenshot:
- Navigate to the Opportunity customization setup page, by clicking the following: Objects and Fields | Object Manager | Account | Fields and Relationships.
- Locate the Fields & Relationships section on the right of the page.
- Click on New.
We will be presented with the Step 1. Choose the field type page.
- Select the Formula option.
- Click on Next.
We will be presented with the Step 2. Choose output type page.
- Enter or paste Opportunity Report in the Field Label textbox.
When clicking out of the Field Label textbox, the Field Name textbox is automatically filled with the value Opportunity_Report.
- Set the Formula Return Type as Text.
- Click on Next.
We will be presented with the Step 3. Enter formula page.
- Paste or enter the following code:
/* Create the link to the Account filtered report */
HYPERLINK( /* Specify the report ID generated in the Getting Ready section
*/ "#/sObject/00O0Y000007hyPoUAI/view?fv0=" /* Specify the Account record ID */ &Id, /* Specify the text for the hyperlink */ "Opportunity Report", /* Specify that the report opens in the same browser tab */ "_self" )
- Optionally, enter a value in the Description field.
- Optionally, enter a value in the Help Text field.
- In the Blank Field Handling section, select the option Treat blank fields as blanks.
- Click on Next, as shown in the following screenshot:
We will be presented with the Step 4. Establish field-level security page.
- Select the profiles to which you want to grant read access to this field via the field-level security. The field will be hidden from all profiles if you do not add it to the field-level security.
- Click on Next.
We will be presented with the Step 5: Add to page layouts page.
- Select the page layouts that should include this field. The field will be added as the last field in the first two-column section of the selected page layouts.
- Finally, click on Save.