Posts

How to Mass Transfer Opportunities using Salesforce Flows

Image
 Problem:  As an Sales Support Analyst, I would like to mass transfer opportunities between users. Salesforce 'Mass Transfer Records' ( Setup | Mass Transfer Records) does not provide opportunity mass transfer and usage of Dataloader is not an option. Solution:  A simple flow can do the trick. The flow can be added to the Home Page (conditionally rendered for certain Admin profiles) or a custom lightning App. Step 1: Navigate to Setup | Flow | New Flow | Screen Flow | Auto-Layout .  Step 2: Click the 'New Resource' button on the Toolbox Step 3: Click 'Add Element' and select 'Screen'. Drag 2 Picklist components into the canvas Step 4: Add 'Update Records' to the flow Step 6: Add the flow to Home page for testing Final flow:

Connecting to Anypoint platform from Anypoint Studio

Image
Anypoint Studio must be connected to Anypoint platform to perform following activities: Deploy an API to Cloudhub environment Publish/consume assets from Exchange Download RAML from Design Center The steps to connect to Anypoint platform through the studio are outlined below:  Traverse through Window>Preferences>Authentication Click on Add button in Authentication settings Click on Configure button in the User login page, which will open up Authentication method window. Choose Anypoint Platform unless authentication is performed through external identity provider like Okta, Ping Identity etc... If an external identity provider is used as an authentication mechanism, then select External identity option and enter the organization domain id Provide anypoint user credentials in Anypoint sigin page to get the user account added to the Authentication settings Organization domain id can be obtained from the user profile by logging in to Anypoint platform through browser. Note: If

How to mass update records in list view using quick actions?

Image
 Updating multiple records on list view can be done using a quick action. In this example lets add a 'Mass Update Leads' quick action to the Leads list view. Navigate to: Setup | Object Manager | Lead | Buttons, Links, and Actions | New Action Action Type: Update a Record Navigate to the action and click 'Edit Layout'. Drag and drop the fields that needs to be included in the mass update. If a field is a required field in the object then it has to be in the Layout or it has to added as a Predefined Field Value. Edit Layout:  Predefined Field Value:  Add the quick action to search layout by navigating to  Setup | Object Manager | Lead | Search Layout for Salesforce Classic | List View | Edit Lets test this 

How to get collection size in Lightning flow without iterating the collection?

Image
 Getting the number of records in a collection is often needed when developing an automation. Using the 'Loop' element to iterate the collection and increasing the count will be inefficient. A better way to do is to use the 'Assignment' element's 'equals count'. 

How to subscribe to BatchApexErrorEvent and send notifications in a flow?

Image
BatchApexErrorEvent notifies subscribers (Apex Triggers, Flows, Processes & Streaming API) of errors and exceptions that occur during the execution of a batch Apex class. This blog focusses on subscribing to the error event using no code flow approach. Prerequisite : The batch Apex class needs to implement Database.RaisesPlatformEvents Flow :  Create a new Flow and select 'Platform Event-Triggered' flow  Choose 'Batch Apex Error Platform Event' platform event  {!$Record} variable provides all the relevant information related to the Batch Apex Error which can be used in sending notification. Start:  Get Custom Notification Type:  Assign Notification Recipients (add to a collection): Send Notification: 

How to get CustomNotificationTypeId in flows without hardcoding?

Image
 Custom notifications are sent to desktop or mobile for anything that needs an user's attention. To get started we need to create a Custom Notification Type by navigating to Setup | Notification Builder | Custom Notifications | New . Creating a custom notification type lets us pick the channels for the notifications (Desktop or Mobile or Both). Problem:   Once we have the custom notification created, we need the CustomNotificationTypeId for using it with "Send Custom Notification" action  in the flow . We can use Developer Console or Workbench to fetch the Id. Problem with fetching the Id and using it hardcoded or storing it in a metadata and using it on a flow are as follows The Id will change when the flow is moved from a sandbox to production environment causing the flow to fail. Refreshing a sandbox will carry the production Id to sandbox and the flow will fail in sandbox. Solution:  Using "Get Record" flow component to get the custom notification record. Ge