Workflow Rules in Salesforce vs Process Builder in Salesforce

Workflow Rules in Salesforce vs Process Builder in Salesforce

Today, Salesforce is the world’s leading Customer relationship management solution provider that helps grow businesses efficiently. Salesforce users leverage the core capabilities and enriched functionalities of Salesforce, from sending reminders to follow up with customers to creating sales projections and reporting accurately for top-level management.

Fortunately, Salesforce enables to create workflows and program tasks to automate business processes. Workflow rules and program tasks can be created with simple drop-down menus and flow charts. You can create a number of rule-based on certain criteria you set like sending an email, task creation, or field updation. These fantastic automation features within Salesforce help eliminate manual entry of data and save valuable time and efforts of sales representatives. 

In this blog post, we will discuss the Workflow rules and Process Builder and the steps that are followed to create a Process Builder in Salesforce.

What are Salesforce Workflow Rules?

Workflow rules are the orders created by a Salesforce user to perform automated actions when certain conditions or series of conditions are met. These tasks can happen suddenly or can be scheduled at a particular time based on a trigger.

Various actions that are performed by Salesforce Workflow:

1. Field Updation – Displays new data after altering a field when certain conditions are met.

2. Sending email – Salesforce users can generate preset emails by including plain text and HTML. These emails can be automatically sent when certain conditions have taken place in Salesforce. You can use mail merge for displaying the recipient’s first name, company, and other personal information.

3. Assigning Task – Once predefined conditions have taken place, you can set a new task for a particular user.

4. Sending a message to a different system

Sending an outgoing XML message to a specific URL outside the Salesforce ecosystem.

Salesforce Workflow has two components for salespeople to get the information about the quantity, type, and results that can be expected based on a certain scenario.

  • Criteria –  These are the “if” part of the procedure that is associated with the rule and must be true in order to perform the action with the linked expression.
  • Actions – These are “then” part. It consists of actions that take place when conditions are met.

What is Salesforce Process Builder?

Salesforce Process Builder is a powerful yet automated tool for Salesforce admin that allows them to:

  • Easily create processes through a convenient layout with point-and-click functionality.
  • Create the whole process in one place rather than using various workflow rules.
  • Create processes by interacting with different teams in your business.
  • Automate simple tasks without using Apex code.
  • Post on chatter to share information with any user.
  • Launch or trigger the flow from your process to automate multiple processes.

Difference between Workflow Rules in Salesforce and Process Builder in Salesforce

With Process Builder, you perform a lot more actions than Workflow Rules such as :

  • Create a record, 
  • Update any related record(Master-Detail – Lookup)
  • Using a quick action to create a record, update a record, or log a call
  • Launch a flow
  • Send an email
  • Publish to chatter
  • Send for approval
  • Call Apex methods

But the process builder does not support outgoing messages.

However, the Workflow can only perform 4 actions:

  • Create Task
  • Update fields (Same Object or Master Object in Master-Detail Relationship)
  • Email notification
  • Outbound Message

Scenario 1 – If there is any change into Contact Name then you need to update the Latest Contact custom field of Associated Account with the latest Changes into the account name.

In this scenario, the Process Builder is perfect because when using workflow we cannot update related records other than master-detail.

Scenario 2 – Update Latest Opportunity custom field of Account Object with the opportunity name that was recently closed.

Workflow is the right and innovative automation tool for the scenario described above, because the relationship between Account and Opportunity is Master-Details and using workflow rule we can update the master record and the same record.

Scenario 3 – Update all related cases and Contacts with the same phone of account whenever the account phone changed.

Process Builder is the perfect tool here because we need to update all contacts and cases. There may be more than one, and the Process builder allows you to do the same thing.

Steps to Create Process Builder in Salesforce

Setup–> Build–> Create–> Workflow and approvals–> Process builder

Step 1: Click on New to create a new process builder. A popup box appears where you need to fill name, description, and choose when to start the process from the following options

  •  A record changes
  •  A platform event occurs
  •  It’s invoked by another process

Then, click Save.

Now the screen will show the flowchart of what a Process Builder in Salesforce looks like.

Step 2: To begin the process, click on the Add Object. A screen appears on the right-hand side where you have to select the object name and the option to start the process and then click on save.

In an advanced option below, select yes if you want to enable the process to evaluate a record many times in a single transaction.

Step 3: Now, select criteria to evaluate the process. Click on Add Criteria, enter the name of criteria, and choose one of the below options for executing actions.

  • Conditions are met
  • Formula evaluates to true
  • No criteria—just execute the actions

Step 4: Click on the add row to add multiple conditions.

Set the condition and select the field and select one of the conditions among:

  • All of the conditions are met (AND)
  • Any of the conditions are met (OR)
  • Customize the logic

If required, we can schedule the action by setting a schedule button that has time and date to select. To Stop the flow click on stop. We can add more flows one after another or click on the activate button to assign data in the correct format and check validation rules. Process builder can perform more actions than Workflows in Salesforce.

Conclusion

Process Builder or Visual representation based Workflow Rules allow users to create customized processes and personalized user experiences. Both tools provide a large selection of actions they can perform based on criteria defined by the user. Available actions can be extended by packages installed in the org. This provides another way in which you can use the features for building customized scenarios. 


Dreamforce 2019 Key Takeaways for Developers and Admins

Dreamforce 2019 Key Takeaways for Developers and Admins

Salesforce’s annual Dreamforce conference wrapped up recently in San Francisco and it was a huge success like all previous editions. 

The four-day event brought together some of the brightest minds and influential leaders in business and featured more than 2,500 different sessions. At Dreamforce 2019, Salesforce unveiled a lot of new updates and features for its products aimed at delivering personalized customer experiences.

Product Announcements at Dreamforce 2019

Customer 360 Truth – A new set of data and identity services that enable companies to build a single source of truth across sales, service, marketing, commerce and more to create a single, universal Salesforce ID for each customer. The goal of Customer 360 Truth is to provide companies easy access to data across multiple systems and a more efficient way to deliver and predict their customers’ needs.

Tableau Tableau has announced Netflix-style AI-based visualization recommendations to help customers quickly find relevant previews and basic updates to Ask Data, and make better decisions.

Tableau has also introduced metrics to let business leaders easily and effortlessly track performance metrics. Users can easily create, track, and view key performance indicators from several dashboards. Also, Tableau has expanded its strategic relationship with Amazon Web Services by announcing Modern Cloud Analytics (MCA), a new initiative designed to help customers harness the full potential of self-service analytics. 

Salesforce and Apple Partnership

Salesforce and Apple have announced three new products at Dreamforce 2019.

Salesforce Mobile App, the revamped CRM application, Trailhead GO, the mobile app for Trailhead for iOS and iPadOS, and Salesforce Mobile SDK to empower developers to easily build and deploy native apps for iPhone and iPad.

Einstein Call Coaching 

The new solution for Sales Cloud enables managers to gain deep insights and identify trends within their sales teams’ conversations with clients.

Salesforce and Amazon Partnership

  • The latest Service Cloud Voice integrates telephony into the Salesforce Service Cloud to provide contact center agents with a complete set of tools in their agent workspaces that provide enhanced customer service support.
  • Salesforce and AWS offer AWS content on Trailhead, Salesforce’s free online training platform, designed to educate anyone on the cloud.

Dreamforce 2019 Announcement for Admins

  • Salesforce has introduced a service cloud voice through which admins can create custom versions of the Voice Assistant for every user with the help of Einstein Voice Assistant and Einstein Voice Skills.
  • Einstein Call Coaching is used to optimizing the sales team’s customer interactions through conversational intelligence.
  • Pardot enhancements include new Lightning email builders and sandboxes.
  • Make sure your data never crosses the public internet using private connect. 
  •  Lightning sandboxes can be refreshed on-demand and created in minutes.
  • With Security Command Centre, the admins can manage security policies and connectivity, view trends, receive proactive alerts and achieve multi-org visibility.

Dreamforce 2019 Announcements for Developers

  • With the Open sourcing Lightning Base Components, you can start developing your User Interface with more than 50 Lightning base components.  
  • Salesforce Blockchain is now available in Development Preview. 
  • Data Masking feature can be used to secure your sandbox data and choose how to encrypt or delete it.
  • Local development server is introduced to create, run and test the local Lightning web component.
  • With the new Einstein API and user interface features, you can create smart links and connections. You can build custom models with clicks with the Einstein Vision and Language application and analyze the text in six languages by Einstein Multi-Language Feature.
  • With the all-new real-time event monitoring features, you can create targeted transaction security policies to prevent data loss. 

Need any assistance with Salesforce development, CRM implementation, data migration, Field Service Lightning, and Salesforce integration with third-party tools such as Outlook, MailChimp, and more? Contact Cloud Analogy – the world’s most trusted Salesforce Consulting Partner and Salesforce Development Company – now!

Apex Trigger in Salesforce

Apex Trigger in Salesforce

Are you looking for the best advice on Apex Triggers in Salesforce to derive more value out of your Salesforce products? If your answer is in the affirmative, this blog on Salesforce Apex Triggers.

Let us pursue this informative journey by understanding about Triggers.

What is a Trigger?

A trigger is an Apex script that executes before or after certain events occur in DML, For example, before the object record is entered into the database or after the record has been deleted. Triggers allow you to carry out custom actions before or after changes to Salesforce records. A trigger is Apex code that is executed before or after the following types of operations such as Insert, update, delete and delete. 

Two types of Apex triggers

Before trigger

This trigger is used to update or verify the value of a record before it is saved in a database.

After trigger

This trigger is used to access values of the record ​​stored in a database and use this value to make changes to other records. After trigger records are in read-only format.

Bulky Trigger

By default, all triggers in Salesforce are bulky triggers. This means you can process many records simultaneously. Bulky triggers can handle  bulk operations and single-record updates, such as the following:

  • Data import
  • Mass Fraction
  • Bulk API calls
  • The recursive apex methods

Trigger Syntax

 trigger myAccountTrigger on Account (before insert, before update) {

  CreateAccount.getAccount();

 }

  1.  myAccountTrigger – triggerName ( It is the name you would want to give your trigger).
  2. Account – Objectname (It is the object on which the action needs to be performed).
  3. before insert, before update – Trigger_events

Before insert: When using this event, the code block gets executed before a new record is inserted.

Before update: When you use this event, the code will get executed before a new record is updated in the object.

Trigger Context Variables:

isExecuting

Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an executeanonymous() API call.

isInsert

Returns true if this trigger was fired due to an insert operation

isUpdate

Returns true if this trigger was fired due to an update operation

isDelete

Returns true if this trigger was fired due to a delete operation.

isBefore

Returns true if this trigger was fired before any record was saved.

isAfter

Returns true if this trigger was fired after all records were saved.

isUndelete

If a record is recovered from the recycle bin it returns trigger true.

new

Returns a list of the new versions of the sObject records. This sObject list is only available in insert, update, and undelete triggers, and the records can only be modified before triggers.

newMap

A map of IDs to the new versions of the sObject records. This map is only available in before update, after insert, after update, and after undelete triggers.

old

Returns a list of the old versions of the sObject records. This sObject list is only available in update and deletes triggers.

oldMap

A map of IDs to the old versions of the sObject records. This map is only available in update and deletes triggers.

size

The total number of records in a trigger invocation.

Triggers in Salesforce vs. Workflow in Salesforce

Workflow

  • It is an automated process that can shoot an action that is based on evaluation and rule criteria.
  • Performing DML operations in the workflow is not possible.
  • We can obtain a workflow over an object.
  • We can’t create a query from the database.

Trigger

  • It is a piece of code which is executed either before or after a record is updated or inserted.
  • More than 15 DML operations can be used in a single trigger.
  • More than 20 SOQLs can be used from the database in a trigger.
  • We can access triggers across an object and related to that object.

Limitations of Workflows overcome by Triggers in Salesforce

  • Workflows are not able to create or update a separate object.
  • You can’t reference certain fields when using workflows.
  • You will not have your workflow doing more than just field updates and emails.

Conclusion

Triggers in Salesforce are called Apex Triggers. A trigger in Salesforce is an Apex code that is used to perform an operation before or after a record is operated.

Want to know more about triggers? Contact our certified Salesforce Consultants now!

How to Write a Test Class for Apex Trigger?

How to Write a Test Class for Apex Trigger?

The Apex testing framework makes sure that developers can write and execute tests for all the Apex Classes and triggers in the Force.com platform. In the testing framework, the code is tested and the testing code is coded in the sandbox environment and then deployed to production Org. 

Apex Test Class Best Practices

1. Use @isTest at the Top for all the test classes.

2. Always put assert statements for negative and positive tests.

3. Utilize the @testSetup method to insert the test data into the Test class that will flow all over the test class.

4. Always make use of Test.startTest() and Test.stopTest() doing this it will increase the governor limit of the salesforce. We also use this to increase the governor’s limit.

5. Use System.runAs() method to test the functionality in user Context.

6. Do not put (seeAllData = true) in test class otherwise, use it for exceptional cases.

7. Avoid Using Hard Coding Ids anywhere in test Class or any apex class.

8. Ensure that each class has a minimum of 75% coverage and also the main functionality has been covered. If possible increase code coverage up to 95%.

9.  All class methods must be tested for at least 200 records and keep the real scenarios in mind.

10. Only one Test.startTest() and Test.stopTest() statement can be in a method, and no of  Test.startTest() and Test.stopTest() statement in any test class depend upon the test methods.

Test Class Example

@isTest

public class setOpportunityOwner 

{

    public TestMethod static void setOpportunityOwner_Method()

    {

        Opportunity opp = New Opportunity();

        opp.name = ‘Hello’;

        opp.stageName = ‘Prospecting’;

        opp.CloseDate = Date.today();

        insert opp;

        Task tk = New Task();

        tk.WhatId = opp.Id;

        tk.Subject = ‘Other’;

        tk.status = ‘Not Started’;

        tk.description = ‘New  Work’;

        Test.startTest();

        Database.SaveResult str = database.insert(tk , False);

        System.assertEquals(True, str.isSuccess());

        Test.stopTest();

    }

}

Advantages of Apex Test Classes

  • You can use Test.isRunningTest() within your code to recognize that the context of the class is Test or not. 
  • You can use this condition with OR (||) operator to enable test classes to highlight inside the Code block.
  • Utilize @TestVisible annotation to identify private members and methods inside Test Class.

Salesforce Tasks in Apex

A task in Salesforce is defined as an assigned action that is required to be done by the user to whom the task is assigned. Tasks can be related to leads, campaigns, contacts, and contracts.

Difference between WhatID and WhoID in Task

WhatID in Salesforce – It represents object type things. It can easily relate to AccountID or an Opportunity ID. The WhatId refers to nonhuman objects like accounts, campaigns, opportunities, or custom objects. WhatId occurs in several different forms that means WhatId equals to the ID of a related object. The label for WhatID is Related To.

WhoID in Task – WhoID represents people things. It can easily relate to Lead ID or a Contact ID. It refers to human-like a lead and a contact. WhoID equals to a contact’s ID or a lead’s ID. The label for WhoID is Name.

Conclusion

The Apex testing framework is an innovative tool enables you to write and execute your Apex Code. Test class code is developed in a Sandbox environment and deployed to a production org. Apex unit tests make sure that your Apex classes and triggers perform as expected. By following the above practices, you can easily write Apex triggers and classes in Salesforce and hence make your system both manageable and Scalable.

In order to learn more about Apex Triggers, check our latest webinar video on 

Change Data Capture & Asynchronous Apex Triggers presented by Sachin Arora, the Scrum Master and Principal Solutions Architect at Cloud Analogy

Mulesoft leverages Istio to manage and secure Microservices

Mulesoft leverages Istio to manage and secure Microservices

Mulesoft, a leading platform provider for developing application networks, has introduced Anypoint Service Mesh, a modern and innovative solution that makes it easy for businesses to govern, manage, and protect microservices.

Anypoint Service Mesh enhances security and reliability for deploying microservice-based apps, irrespective of the deployment model or any language. It also helps development teams get rid of any obsolete custom code.

With Anypoint Service Mesh, businesses will be able to discover and promote microservices in a marketplace, enabling developers within an organization to discover and reutilize them. Furthermore, IT departments will now be able to create and maintain the highest standards of security and control. 

With this groundbreaking new version of the Anypoint Platform, businesses can take full advantage of microservices for faster innovation, deliver more personalized customer experience, and improve operational efficiency.

The Emergence of Microservices

With Microservices, businesses can now quickly create great customer experience by providing data and functionality as a bundle of loosely coupled services. Its actual value comes from combining various microservices to meet business needs. With microservices, businesses would now be able to quickly respond to ever-changing customer needs and requirements and offer services that create a competitive advantage.

Nevertheless, more and more microservices are created and organized for business opportunities and business ended-up with complex environments that can be expensive and difficult to manage.

Loosely coupled services need an understanding of interactions between services to minimize the burden of changes later on. For making changes, regardless of functional or security considerations, or scalability reasons, a number of dependent services and applications must be regenerated. This leads to errors, unexpected side effects, and delays. Furthermore, this increases the need to secure path-dependency in networks. This complexity can suppress innovation and destroy microservice capabilities.

Anypoint Service Mesh: An extension of the API-led approach to the microservice architecture

Businesses can only utilize microservice architecture by removing custom code and the complexity of managing different services. Developers must also be able to discover and reuse microservices developed by other teams – destroying organization silos to streamline the capabilities of speed, flexibility, and agility from microservices.

As more and more applications are distributed and stored, a Service Mesh is an important element of the microservice infrastructure, increasing the durability and security of applications. However, Service Mesh does not address all problems and challenges in the microservice lifecycle independently. Organizations must continue to easily publish and reuse microservices throughout teams. 

In addition, Service Mesh offers these and more benefits for a number of microservices across the specific deployment. Despite the language or deployment model, businesses require an innovative way to review and manage all services.

Benefits of Mulesoft Anypoint Platform’s single control plane

  • Find out which microservices are available and how they operate in synchronization.
  • Visualize microservice dependencies using application network diagrams.
  • Increase acceptance and reuse by adding Microservices to the Anypoint Exchange.
  • Centralized management and scaling of microservice architecture.
  • Ensuring flexibility between services and Istio’s traffic control policy.
  • Estimate and maximize the performance of all microservices through API Analytics. 
  • Enable standard security.
  • With Istio implement TLS for all traffic and register policies to create a zero-trust network.
  • Automatic access control on microservices outside the service mesh.

MuleSoft Anypoint Platform helps businesses take advantage of the architecture by creating API-based connectivity for microservices. An API-based approach allows businesses to open the value of their existing API services and innovate quickly while maintaining the security and control of important company data or processes. It provides the concept of providing a flexible operational model and developing reuse and discovery for the entire organization through the application network. This increases the speed and flexibility of the business processes to create a competitive edge.

By expanding the Anypoint platform to any microservice with Istio, Anypoint Service Mesh brings the principles of openness, management, and security to microservices. 

Pin It on Pinterest