Salesforce Buttons
You can add buttons in Salesforce to view, download, or send your Unaric Reports Solution. For example, you could set up a button on Contacts to view open up their list of Open Cases report and perform AI analysis to spot trends and provide recommendations.
Button types
Type | What it does |
|---|---|
View | Opens the Solution in a new tab |
Download | Downloads the file based on Solution configuration |
Send | Opens email preview and allows sending |
Prerequisites
Install button package
For using buttons in Salesforce Lightning, you will need to install the following package for all users:
Enable profile access
If you are using Salesforce Lightning, users must have profile access to the required Apex classes and Visualforce pages included in the Lightning package. Without this access, the button will fail to load or return a permissions' error.
To enable access:
- On Salesforce, navigate to Setup > Profiles.
- Open the profiles that will use the button. Make sure access is granted to all profiles that should be able to run the Solution from Salesforce.
- Grant access to:
- Apex Classes
- ReportBuilderController
- ReportBuilderWebTabController
- Visualforce Pages
- ReportBuilder
- ReportBuilderLink
Setup
Create the button
- In Salesforce, navigate to Setup > Objects and Fields > Object Manager.
- Select the object you wish to add the button.
- Go to the Buttons, Links, and Layouts tab and click the New Button or Link button.
Configure the button
Enter the values for button based on how you would like it to work. Set the Content Source to URL and set this field to the following (replacing variables):
URL parameters reference
Parameter | Description |
|---|---|
SOLUTION_ID | ID of the Solution (example: 99610) |
SESSION_ID | {!$Api.Session_ID} |
SERVER_URL | {!$Api.Partner_Server_URL_570} |
FILTER_VALUE | Filter value that will be supplied to the Solution. Usually the record ID (example: {!Contact.Id}) |
PROFILE_ID (optional) | {!User.ProfileId}This can be used to restrict which profiles are allowed to run Solutions from Salesforce buttons. |
Type | view / download / send |
Additional variables
Optionally, you can pass in additional variables on your Salesforce button using the pv prefix.
For example, if you have a Salesforce button on an Account and you want to send a list of Cases IDs, add a request parameter of pvCaseIds={!CasesIds}. This is mainly used to provide real time filtering of a report such as if you want to let the user select a list of Cases to be included in a report.
Pre-made URLs
You can copy and paste these pre-made URLs. Change {!FILTER_VALUE} to the field to field you want to filter on, e.g., {!Contact.Id}:
- View /apex/ReportBuilderDirectLink?solutionId=99610&filterValue={!FILTER_VALUE}&type=view
- Download apex/ReportBuilderDirectLink?solutionId=99610&filterValue={!FILTER_VALUE}&type=download
- Send /apex/ReportBuilderDirectLink?solutionId=99610&filterValue={!FILTER_VALUE}&type=send
Add to the page layout
Save the button and then add the button to the page layouts you want to use the button on.
Running user & permissions
When a Solution is run through a Salesforce button, the running user will be who clicked the button. As such, these users must have access to anything in Salesforce that is required to run that Solution, such as reports, dashboards, objects, fields, etc. Moreover, since everything is run by them, the Solution will only bring in data that the user has access to.
From a security perspective, it is fine to allow all users to run Solutions from Salesforce buttons—Unaric Reports isn’t elevating privileges as it relies on Salesforce’s existing security framework. Hence, admins can set up a single Solution that can be used by many users. However, there may be times when you only want a Solution to be run using a Salesforce button by specific Salesforce profiles. To do this:
- On Unaric Reports, open the Solutions page and select the solution you wish to administer permissions.
- Click the Edit button.
- On the Solutions Wizard, go to the Options step.
- Select the Configure Profiles checkbox and select the profiles you want to enable and disable for this Solution.
- Click Finish.
You can also control which users can see buttons in Salesforce using a combination of Record Types and Page Layouts. Doing it on the Solution ensures users cannot bypass the Record Types and Page Layout setup, for example, by changing the Solution ID on the URL that is opened when they click a button.