Uncategorized

  • Import Content

    Content Document :

    It Represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files. The maximum number of documents that can be published is 30,000,000. This object record you don’t have to create. It gets created when you create ContentVersion which is the child of ContentDocument.

    Content Version:

    Represents a specific version of a document in Salesforce CRM Content or Salesforce Files. In other words, this object stores document information similar to Attachment.

    Import ContentDocument & ContentVersions

    Prepare the CSV file to insert to the ContentVersion object

    • Create a CSV file with the below fields..
      Title – (Required) file name
      VersionData – (Required) complete path to the file you’re uploading from your local machine or drive
      Description – (Optional) link description or file
      PathOnClient – (Required) complete path to the file you’re uploading
      FirstPublishLocationId – (Optional) if you are only relating the File to a single record in Salesforce, populate this with the related record’s Id. This automatically creates a ContentDocumentLink to associate the file to the related record to effectively skip the ‘Prepare a CSV and perform an insert to the ContentDocumentLink object to associate Files to records’ steps below

    Notes :

      • Setting FirstPublishLocationId is only applicable on insert of new files and the field does not accept updates
      • The Sharetype of the created ContentDocumentLink to the related record is Visible by Default

    • Open data loader and login
    • Select Insert and select Show all Salesforce objects
    • Select ContentVersion
    • Browse to your CSV file
    • Click Create or Edit a Map then select Auto-Match fields to columns
    • Click OK | Next | Finish

    Create a CSV and perform an insert to the ContentDocumentLinkobject

    • You can use Data Loader for exporting data from the ‘ContentVersion’ object to get ‘ContentDocumentId’ for your newly created Files
      • Note : If you specified FirstPublishLocationId on File insert, the following steps are only necessary to associate the newly created Files to additional records in Salesforce
    • Create a CSV file with the following columns:
      • LinkedEntityID – (Required) ID of the related record that the file is associated with (Accounts or Opportunities)
      • ShareType – (Required) the permission granted to user. For valid values, see the ‘Description’ details for the field in the ContentDocumentLink | SOAP API Developer Guide
      • ContentDocumentID – (Required) ContentDocumentID from the exported ContentVersion file (starts with ‘069’)
      • Visibility – (Optional) Specifies whether this file is available to all users, internal users, or shared user. Refer to the field’s ‘Description’ details in the guide linked above
    • Now Open Data Loader and click on Insert
    • Select the Show all Salesforce objects
    • Select ContentDocumentLink
    • Browse to your CSV file
    • Click Create or Edit a Map then select Auto-Match fields to columns
    • Click OK | Next | Finish

    Some important Points :

      • While inserting the ContentVersion, create a new custom field to store the legacy content version Id and Content Document Id
      • Now, after inserting the ContentVersion export the data with the new fields that you created
      • While preparing the file for Content Document Link you can use VLOOKUP to get the New Content Document Id based on the Legacy Content Document Id

  • Flow

    What is a Flow in Salesforce?

    Flow is an application inside the Salesforce that automates a business process by collecting data and performing operations in your org or an external system. Flow can fetch, delete, update and create records on multiple objects.

    Flow Builder is the declarative interface used to build individual flows. Flow Builder can be used to build code-like logic without using a programming language.

    Types of Flow:


    Screen Flow

    Requires user interaction because it includes screens, local actions, steps, choices,or dynamic choices. Screen flows don’t support Pause elements.

    Autolaunched Flow with No Flow Trigger

    Doesn’t require user interaction. This flow type doesn’t support screens, local actions, choices, or choice sets.

    Autolaunched Flow with a Schedule Trigger

    Runs only from a schedule. This flow type doesn’t support user interaction, screens,local actions, choices, or choice sets.

    Autolaunched Flow with a Record Trigger

    Makes before-save updates to the new or changed record that launches the flow. Only these elements are supported: Assignment, Decision, Get Records, and Loop.

    User Provisioning Flow

    Provisions users for third-party services. For example, use this flow type to customize the user provisioning configuration for a connected app to link Salesforce users with their Google Apps accounts.

    Field Service Mobile Flow

    Requires user interaction because it has one or more screens.

    Field Service Embedded Flow

    Requires user interaction because it has one or more screens.

    Contact Request Flow

    Requires user interaction because it has one or more screens.

    Checkout Flow

    Used in Lightning B2B Commerce to create a checkout for your store. Requires user interaction because it has one or more screens.

    Below is an example of a schedule-triggered flow, pulled from a well-known Salesforce group:

    When or Why should flow be used?

    We need to know what automation is needed. In most cases, the type of automation is determined by evaluating where the data for the processes originates from and where it needs to go. Consider whether what you need to accomplish is best handled by a flow, workflow field update, or a process.

    • The workflow field update can write data to the same record that invoked the workflow rule, or to the master record of a master-detail relationship on the record that invoked the rule. Workflow rules are not able to create, edit, or delete records.
    • Flows are able to create, edit, and delete any record passed into the flow. Records do not have to be related in order to pass data in a flow. Flows can also be scheduled to run on a set interval with a collection of records.
    • Processes, created in the Process Builder, can write data to the same record that invoked the process, or to records related by either lookup or master-detail relationships. Processes can also create records, but they cannot delete them.

    How to create a flow in Salesforce?

    To create the flow, follow these steps:

    Go to Setup -> Quick Find Box -> Search for “Flows” -> Click on Flows -> Then Click New Flow

    It will open below screen.

    You can create any of the four flows. Here I am creating Autolaunched Flow which will send an email to the selected users when a lead is created. For that I am creating a flow:

    First, I’ll get the record from any of the object using any source of the flow, for that first we need to create a new resource of data type record:

    Then you need to go to the elements tab:

    Then run the flow:

    And the mail will be sent to the Lead Owner.

    Flows vs. Apex

    • Apex code requires a developer and Sandbox to deploy, meaning it can only really be built in organizations using a Professional or above edition of Salesforce. Flows can be built in all editions, as a Sandbox is not required for deployment.
    • Apex is not available in Essentials, and some Apex features are limited in Professional. Organizations with Enterprise and above have no Apex limitations, but flow features are not limited based on the edition.
    • Apex code requires constant development and discipline to maintain. Flows require less work to keep up-to-date.
    • Flows can be built by admins, while Apex code is typically built by developers only.
    • Apex code is considered a tool of last resort. Flows are simpler and should be used before Apex code.
    • If the logic is too complex, Apex code should be used. There is unlimited potential with Apex; flow capabilities are catching up, but they are still inferior to Apex.
    • Renewal generation, OLI creation, and other pieces of automation that were traditionally built as Apex code can now be built as flows, preserving code space for projects that require Apex.

    Apex code should be used in the following scenarios:

    • You’re dealing with complex Salesforce automation that requires multiple steps and actions where a flow will become cumbersome.
    • You need custom-built integrations with other systems (such as a connection to a SQL database that requires bi-directional syncs).
    • ERP integrations are involved.

    Flows vs. Processes

    • Processes are more user-friendly as far setup and management goes. Setting up a flow takes more time and is significantly more complex.
    • Flows allow you to add screens where users can enter data. Processes do not have this capability.
    • Flows can be invoked, started by users, triggered by a record change, or scheduled to run on their own at a custom time and frequency. A process, however, runs automatically (either immediately or scheduled) when criteria is met. It can also be invoked by another process created in the Process Builder.
    • Both flows and process can include scheduled actions.
    • Flows can be paused by users, but processes run when the criteria is met and cannot be paused.
    • Flows and processes both contribute to CPU limits and other automation limits in Salesforce.
    • Process actions are executed in the order in which they appear in the process definition, but flows can have different and more complex orders of operations.
    • Flows can be built to cycle through multiple unrelated and related objects. Processes, however, are limited to the base object (opportunities, for example) and related objects (accounts).
    • The following actions are only available for processes:
    • Quip actions
    • Send survey invitation
    • Invoke a flow
    • Flows can be designed to run either before or after a record has been saved to the database, but processes can only trigger after a record has been saved.
    • Flows can be designed to trigger upon creation, update, or deletion of a record. Processes can trigger only for creation or updates to a record.

    Here are a few real-life examples of where a process makes more sense than a flow:

    • You need to automatically submit an opportunity for approval when the value in the Amount field is greater than $200,000.
    • When an account is deactivated, you want to deactivate all the associated contacts.
    • After creating a new user or internal contact, you want to create a case for background verification.
    • You need to invoke custom approval logic that is written in Apex code.

    Flows vs. Workflow Rules

    • Flows are available in all Salesforce editions, including Essentials. Workflow rules (WFRs) are not available in Essentials or Professional editions.
    • WFRs are not actively being updated by Salesforce (but you can still use them for the time being). Flows are constantly being updated with new features and capabilities in each Salesforce release.
    • There are limitations with how many WFRs can be active at once, but they typically do not contribute to CPU limits unless the WFR triggers a process or flow through one of its updates (such as a field update).
    • Both flows and WFRs can have scheduled actions, but WFRs are limited to 1000 triggers per hour.
    • WFRs can only make one decision, but you can call other flows and Apex code with a flow.
    • WFRs are limited to just a few actions: creating a task record, sending an email, updating a field, or sending an outbound message. Flows can do all of these actions and many more.

    This is a use case where a WFR makes more sense than a Flow.

    • You want simple field updates, such as outbound emails or sending email alerts when high priority cases are created.

    How to launch a Salesforce Screen Flow from a button?

    First, go to Setup > Object Manager and locate the object you want to add the button to. That’s the Opportunity object in our case. On the left side of the screen, select “Buttons, Links and Actions” and then click “New Action”.

    The New Action screen looks like this:

    Change the Action Type [1] picklist to Flow. The next field will change to a picklist of available Screen Flows [2]. If you don’t see your Flow in this list, go back and check that a) it’s a Screen Flow, not an Autolaunched Flow and b) that you set it to active in the Flow Builder.

    Select your Flow.

    Enter a Label and Name, then click Save. Note that the label is what the text the button will show in the UI so keep it fairly short.

    Go to Page Layouts in the left nav and click into the page layout you’re using for this record type:

    In the layout controls, select “Mobile & Lightning Actions”. You should see your new action listed there. Drag it into the “Salesforce Mobile and Lightning Experience Actions” section. (If your “Salesforce Mobile and Lightning Experience Actions” section doesn’t look like the above, you may need to click the little wrench icon to allow you to modify it.) Click Save.

    Click it!

  • Platform Event

    Introduction to Platform Events in Salesforce :

    • Consider this, a platform event is just like another custom object but this would only be referred by external systems to communicate with Salesforce. 
    • To put this in a scenario when a certain system posts data on a Salesforce endpoint then that data should be fetched and the data in Salesforce should be updated. 
    • Of course, you can use too many lines of code to continuously fetch and retrieve the data from the endpoint or just wait for data to be posted based on which an event shall be triggered and the next processes shall follow. 
    • Now, this is where platform events come into the picture, instead of writing lines and lines of codes and continuously requesting and checking if the data is posted we can just have a platform event trigger notify us and then have your logic do the rest of the heavy lifting.

    What are Platform Events in Salesforce?

    • Platform Event is based on Event-Driven Architecture which enables apps to communicate inside and outside of Salesforce. 
    • Platform events are based on the publish/subscribe model and work directly with a message bus which handles the queue of incoming events and processes listening for them. 
    • This is built in real time integration patterns in the Salesforce Platform which helps to reduce point-to-point integration.

    Here Are The Following Points We Should Remember :

    • Event: An adjustment in the expression that is important in a business procedure. 
    • Event Message/Notification: A message that contains information about the Event. 
    • Event Maker: The distributer of an occasion message over a channel. 
    • Channel: A conductor where an occasion maker sends a message. Event shoppers buy into the channel to get messages. Likewise alluded to as Event transport in Salesforce. 
    • Event Consumer: A supporter of a channel that gets messages from the channel.

    Publishing and subscribing Platform events :

    • Publishing and subscribing to the platform event are more flexible. 
    • You can publish event messages from a Force.com app or an external app using Apex or Salesforce APIs and you can subscribe from the Salesforce or external apps or use long polling with cometD as well.

    Define Platform Event :

    Define platform events similar like a custom object, go to setup –> develope –> Platform events –> create new platform events as shown below.

    Publish Platform events

    Publish Using Apex :

    • A trigger processes platform event notification sequentially in the order they’re received and trigger runs in its own process asynchronously and isn’t part of the transaction that published the event. 
    • Salesforce has a special class to publish the platform events EventBus which is having methods publish method. once the event is published you can consume the events from the channel.

    trigger PlatformEventPublish on Account (after insert , after update ) {

        If(trigger.isAfter && trigger.isUpdate){

            List<Employee_On_boarding__e> publishEvents = new List<Employee_On_boarding__e>();

            for(Account a : Trigger.new){

                Employee_On_boarding__e eve = new Employee_On_boarding__e();

                eve.Name__c = a.Name ;

                eve.Phone__c = a.Phone ;

                eve.Salary__c = a.AnnualRevenue ;

                publishEvents.add(eve);            

            }

            if(publishEvents.size()>0){

                EventBus.publish(publishEvents);

            }

        }

    }

    Publish Using Process Builder :

    Publish Events by Flow :

    • Run/Debug Flow:1(platform Event producer) and you will send post in chatter.

    Result:

    Subscribe for Platform events :

    • We can subscribe to the platform events from the Platform events object trigger which is created. 
    • Here is the sample trigger show how you can handle the subscribed events. create new accounts from the platform event but you can implement your own business logic to update the data.

    trigger OnBoardingTrigger on Employee_On_boarding__e (after insert) {

        List<Account> acc = new List<Account>();

        for(Employee_On_boarding__e oBording :trigger.new){

            acc.add(new Account(Name =oBording.Name__c , Phone =oBording.Phone__c , AnnualRevenue = oBording.Salary__c));

        }

        if(acc.size() >0){

            insert acc ;

        }

    }

    • you can consume the platform events by using this  URI /event/Employee_On_boarding__e and the Complete code is here below

    <apex:page standardStylesheets=”false” showHeader=”false” sidebar=”false”>

        <div id=”content”> 

        </div>

        <apex:includeScript value=”{!$Resource.cometd}”/>

        <apex:includeScript value=”{!$Resource.jquery}”/>

        <apex:includeScript value=”{!$Resource.json2}”/>

        <apex:includeScript value=”{!$Resource.jquery_cometd}”/>

        <script type=”text/javascript”>

        (function($){

            $(document).ready(function() {

                $.cometd.configure({

                    url: window.location.protocol+’//’+window.location.hostname+ (null != window.location.port ? (‘:’+window.location.port) : ”) +’/cometd/40.0/’,

                    requestHeaders: { Authorization: ‘OAuth {!$Api.Session_ID}’}

                });

                $.cometd.handshake();

                $.cometd.addListener(‘/meta/handshake’, function(message) {

                    $.cometd.subscribe(‘/event/Employee_On_boarding__e’, function(message) {

                        var div = document.getElementById(‘content’);

                                        div.innerHTML = div.innerHTML + ‘<p>Notification </p><br/>’ +

                            ‘Streaming Message ‘ + JSON.stringify(message) + ‘</p><br>’;

                    });

                })

            });

        })(jQuery)

        </script>

    </apex:page>

        

    Advantages of Salesforce Platform Events :

    • Clients can run organizations quicker on an event-driven architecture.
    • Make an entire 360-degree client experience – continuous reconciliation with any business cycle.
    • Event-driven work processes to enlarge information.
    • Can catch and follow up on a great many streaming events.
  • Lightning Reports & Dashboards Limitations And Allocations

    What Is A Report?

    A report is a list of records(like accounts or contacts) which must meet the criteria you defined in that. Various things you can do on report is filter, Group and math on records. There are benefits of using Report because it is stored in a folder. Report folders determine who can access the report because they can be shared in public, hidden or shared. You have the power to give access to organizations or it can be private at individual levels.

    Limitations of Report :

    • In Salesforce Classic, you can have a maximum 250 groups or 4,000 values in a chart. If an error message comes saying that your chart has too many groups or values to plot,then to reduce the number you have to adjust the report filters.
    • In Lightning Experience, a report chart can have at most 2000 groups. If a report has more than 2000 groups, the action ‘Combine Small Groups into Others’ applies only to the small groups within the 2000 that are included in the report chart. Any additional small groups are ignored.
    • Reports display a maximum of 2,000 rows. Export the report to Excel or use the printable view for tabular and summary reports to view more rows . For joined reports, the printable view displays a maximum of 20,000 rows. Printable view is only available in Salesforce Classic.
      • Summary reports (grouped by rows) and matrix reports (grouped by columns) display the first 2,000 groupings when Show Details is disabled.
      • Matrix reports display a maximum of 400,000 summarized values.
      • Matrix reports that return more than 2,000 rows don’t show details. If you click Show Details, nothing happens. You can only view the report with details hidden.
      • Because a matrix report includes multiple groupings, the maximum of 2000 values is typically reported in fewer than 2000 groups.
      • Matrix reports display a maximum of 2,000 groupings in the vertical axis when Show Details is disabled. If there are more than 400,000 summarized values, rows are removed until the 2,000 groupings limit is met. Then columns are removed until the number of summarized values moves below 400,000.
    • The report builder preview shows a maximum of 20 rows for summary reports (grouped by rows) and matrix reports (grouped by columns), and 50 rows for tabular reports (no groupings).
    • Up to five metrics display in the Lightning Experience report header. Metrics such as summarized fields appear in the order that they appear in the report, left to right. The grand total, when shown, always displays.
    • When viewed in the Salesforce mobile app, reports that have groupings are converted to tabular reports.
    • A maximum of 25 report columns is supported by the Salesforce mobile app.
    • By default, reports timeout after 10 minutes.
    • Each block can have up to 100 columns in a joined report.A joined report can have up to 5 blocks.
    • You can add up to 10 custom summary formulas to each block in a joined report. A joined report can have a total of 50 custom summary formulas.
    • When you add a block to a joined report and the block has multiple entities in common with the report, only the first entity (in alphabetical order) is shown. Only the fields from the first entity are shown in the common fields area.
    • Each joined report can have up to 10 cross-block custom summary formulas.
    • In a non-joined report, if you click a bar in a report chart, the report results are filtered according to the selected bar. In a joined report, clicking a bar doesn’t apply the filter.
    • If you filter on standard long text area fields, such as Description or Solution Details, only the first 1000 characters of the field are searched for matches in reports.
    • Some filters (such as date range) are constructed using multiple custom filters, each of which counts towards the total of 20.
    • Field-to-field filtering isn’t available on currency fields for orgs that have multi-currency enabled.
    • The first 999 characters in a standard rich text area or a long text area are displayed in a report. For custom fields, only the first 255 characters are displayed.
    • Up to 21-digits can be displayed by summary fields on tabular, summary, and matrix reports.
    • Reports can’t be filtered on custom long text area fields.
    • Joined reports require that the new user interface theme is enabled. Users without the new theme are unable to create, edit, or run joined reports.
    • In Lightning Experience, embedded report charts display the source report table’s groupings, not the report chart’s. In Salesforce Classic, embedded report charts display the source report chart’s grouping, not the report table’s groupings.
    • Forecast reports include only opportunities that are set to close within the forecast period, except those assigned to the Omitted forecast category.
    • Joined Reports does not support Internet Explorer 6.
    • Acceptable range for values: The maximum value allowed is 999999999999999. The minimum value allowed is -99999999999999.
    • Up to 500 individual recipients can be added.
    • Users sometimes don’t receive the updated report if a role or group contains more than 500 users.
    • Maximum of 5 reports can be subscribed by each person in org.
     

    What Is A Dashboard?

     

    A dashboard is a displaying records in virtual form. There is a relation between a dashboard component and report in the form of ration i.e.1:1. It means for each dashboard component there has to be a single report. Similar to reports, we have dashboards stored in folders, which determines who can access the dashboard. There are Dynamic dashboards which are useful for users who are always logged in.

    Limitations of Dashboard:

    • A dashboard table or chart can display a maximum of 20 photos.
    • A dashboard filter can have up to 50 values.
    • Each dashboard can have up to 20 components.
    • You cannot apply filter on bucket fields. However, you can use a report filtered on a bucket field on the dashboard page.
    • You have to wait at least one minute between dashboard refreshes.
    • Up to 500 individual recipients can be added. A recipient is a user, role, or group.
    • If a role or group contains more than 500 users, some users don’t receive the updated dashboard.
    • Filtering is restricted in some dashboards that contain multiple components based on different report types:
      • You can’t filter the dashboard on the Case Owner or Lead Owner field if a dashboard has a component based on Cases or Leads and another component based on a different report type. In addition, filtering on other Owner fields doesn’t display Case Owner or Lead Owner as equivalent fields.
      • If a dashboard has a component based on the Tasks and Events, Activities with Accounts, or Activities with Contacts report type and another component based on a different report type, you can’t filter the dashboard on the Assigned field.
    • Downloaded and shared images of dashboard component tables have a maximum height of 3000 pixels or approximately 100 rows. Extra rows beyond the limit are clipped. To avoid clipping, filter the chart to fewer than 100 rows.
    • The total value isn’t included in subscription emails for funnel charts.
    • File attachments for report subscriptions are limited to 15,000 rows, 30 columns, and 3 MB file size. Extra data is clipped or not sent.
    • Maximum of 5 dashboards can be subscribed by each person in your org.
  • Introduction to Slack : Slack is the #1 communication platform for business thanks to how intuitive and seamless it is to connect team members in every industry. Features like search, shared channels, apps and integrations, and pinned items make it the go-to option for teams around the world.The Slackforce integration is not new, there have […]

    Read More