This article explains some basic SightLane techniques and provides readers with a hands-on platform experience based on their reading from articles on this site. Use the trail below to take your first steps with SightLane and help prepare for the SightLane certification exams.
1. Install and Configure SightLane
Begin by installing the application and performing basic setup actions. This project does not use all settings, but feel free to experiment with them yourself!
- Install the SightLane package
- Find the SightLane Settings in CustomMetadata
- Add yourself to the Default Team
- Configure the system to send Default notifications for any failure or any Event that needs review
- Update the system to archive Events after 7 days
- Configure AutoCapture for Flow Errors
2. Create the "Add Contact" Flow
Now that SightLane is properly configured let's create a new Flow to illustrate the power of AutoCapture. This Flow will allow users to add a new Contact to Salesforce. If you have configured AutoCapture correctly, you should not need to add any SightLane components to this Flow. Once you have built the Flow, add it to a Lightning page for the full experience.
- Build a screen Flow that creates a new Contact with the FirstName, LastName, and Email
- Run the Flow and enter the First Name and Email, but leave the Last Name field blank.
- Verify that you receive a Flow error email from SightLane
- Click the link in the email to review the Event record
3. Audit the "Add Contact" Flow
Now that you have seen the AutoCapture for Flow Errors, let's change the Flow to provide custom auditing and track the content and logic of this very simple process (Example Image).
- Create a SightLane logs variable in the Flow
- Use an assignment component to add the phrase "The Event is starting..." to the Event
- Following the Flow screen, use a "Log Event Record Data" component to add all Contact fields to the Event log.
- Use a "Report new Event to SightLane" component to save the logs to Salesforce
- Run the flow again and verify the Event content in Control Center
3. Customize the "Add Contact" Flow Monitor
Let's update the SightLane Monitor so the system will notify us of Events that may need our attention.
- Navigate to the Create Contact Monitor page.
- Remove the Email Response record from the Monitor page (Thinking Question: Why was this Response already on the Monitor record?)
- Create a new In-App Notification Response record that runs for all Response Triggers
- Run the monitor again and verify that you received an In-App notification
- Click the In-App notification to verify the Event content (the logs)
- Now, add the monitor to a new Monitor Group called "Contact Management"
- Return to the Control Center and verify that the Monitor Group is available and contains the Create Contact Flow monitor (Example Image)
4. Review Content in the Live Stream
- Navigate to the Live Stream and see the history of your Events
- Type "failed" into the search box and verify that only the failures are visible
5. Bonus Content: Write your first Apex monitor
Even if you are not a seasoned Apex developer, go ahead and try to create this simple Apex class monitor. All the steps are below, as well as a few example pictures, so you'll know you're on track. We know you can do it!
- Add a Monitored Apex Class class to Salesforce (Go to Setup -> Classes and press the "New" button
- Paste in the following code and hit Save!
public class MyFirstMonitor { public static void myMonitoredProcess(){ sightlane.EventLogger logger = sightlane.Logging.startLog('Apex Event'); Integer counter = 0; for(Account acct : [select Name from Account limit 50]){ logger.log('Account Name is ' + acct.Name); counter++; } logger.logSpace(); logger.log('You found ' + counter + ' Accounts!'); logger.reportToSightLane(); } public static void myMonitoredProcessError(){ sightlane.EventLogger logger = sightlane.Logging.startLog('Apex Error'); try { logger.log('Starting the Event Process...'); Integer counter = 4/0; // Uh oh! T logger.reportToSightLane(); } catch (Exception e) { logger.reportFailureToSightLane(e); } } }
- Open Developer Console and go to Debug -> Open Execute Anonymous Window (Example Image)
- Paste in the following code and then hit the 'Execute' button
MyFirstMonitor.myMonitoredProcess();
MyFirstMonitor.myMonitoredProcessError();
- Go to Control Center and verify the new monitor and event
- Open the Apex Error Event and select the Insights tab to verify the available Insights
- Add a new Insight, based on your amazing Salesforce knowledge
- Select the Source Code tab and review the captured exception details (Example Image)
Summary
Now that you've had a little experience in working with the basics of SightLane, you are ready to take it to the world. Try these techniques and experiment with your own ideas, as you work to improve visibility and responsiveness in all your Salesforce environments. As always, if you run into trouble, don't hesitate to reach out to us at support@sightlane.com.