What are REST Web Services?

What are REST Web Services?

A REST (Representational State Transfer) resource is an abstraction of a piece of information or an action such as a single data record, a collection of records, or a query. Each resource in REST API is identified by a named Uniform Resource Identifier (URI) and accessed using standard HTTP methods (HEAD, GET, POST, PATCH, DELETE). REST API is based on the usage of resources, their Uniform Resource Identifiers (URIs), and the links between them.

You can use a resource to interact with your Salesforce org. For instance, you can perform actions such as:

  • Retrieve summary information about the Application programming interface (API) versions available to you.
  • Obtain detailed information about a Salesforce object, such as Account, User, or a custom object.
  • Perform a query or search.
  • Update or delete records.

A REST request consists of four components: a resource URI, an HTTP method, request headers, and a request body. Request headers specify metadata for the request. The request body specifies data for the request, when necessary. If there’s no data to specify, the body is omitted from the request.

Basically, Restful services are REST architecture based on Web Services. RESTful web services are lightweight, highly scalable, and maintainable and are used to craft APIs for web-based applications.

Benefits of Restful Web Services

Fast: RESTful Web Services are fast because there are no strict specifications like SOAP. It uses less bandwidth and resources.

Language and platform-independent: RESTful web services can be written in any programming language and run on any platform.

Can use SOAP: RESTful web services can use SOAP (Simple Object Access Protocol) web services as the implementation tools.

Allows various data formats: RESTful web service allows various data formats such as Plain text, HTML, XML, and JSON.

Apex REST Methods

Apex REST supports two formats for representations of resources: JSON and XML.

JSON representations are passed by default in the body of a request or response and the format is indicated by the Content-Type property in the HTTP header. You can retrieve the body as a Blob from the HttpRequest object if there are no parameters to the Apex method.

If parameters are defined in the Apex method, an attempt is made to deserialize the request body into those parameters. If the Apex method has a non-void return type, the resource representation is serialized into the response body.

These return and parameter types are allowed:

  • Apex primitives (excluding sObject and Blob).
  • sObjects
  • Lists or maps of Apex primitives or sObjects (only maps with String keys are supported).
  • User-defined types that contain member variables of the types listed above.

Methods annotated with @HttpGet or @HttpDelete should have no parameters. This is because GET and DELETE requests have no request body, so there’s nothing to deserialize.

A single Apex class annotated with @RestResource can’t have multiple methods annotated with the same HTTP request method. For example, the same class can’t have two methods annotated with @HttpGet.

Example:

You can use user-defined types for parameters in your Apex REST methods. Apex REST deserializes request data into public, private, or global class member variables of the user-defined type unless the variable is declared as static or transient. For example, an Apex REST method that contains a user-defined type parameter might look like the following:

@RestResource(urlMapping=’/user_defined_type_example/*’)

global with sharing class MyOwnTypeRestResource {

    @HttpPost

    global static MyUserDefinedClass echoMyType(MyUserDefinedClass ic) {

        return ic;

    }

    global class MyUserDefinedClass {

        global String string1;

        global String string2 { get; set; }

        private String privateString;

        global transient String transientString;

        global static String staticString;

    }

}

Valid JSON and XML request data for this method would look like:

{ “ic” : {

                “string1” : “value for string1”,

                “string2” : “value for string2”,

                “privateString” : “value for privateString” 

}}

Conclusion

REST stands for Representational State Transfer. REST is used to build lightweight, well-maintained and scalable web services. The main aspects of REST are the resources on the server and the verbs GET, POST, PUT, and DELETE which can be used to work with these resources. Visual Studio and .NET can be used to build Restful Web Services.

If you are looking for certified Salesforce developers or Salesforce implementation partners, Cloud Analogy — the world’s leading and most successful Salesforce Development Company — would be the right choice for you.

React Native vs. Flutter – Which is right for Your Cross-Platform App Development?

React Native vs. Flutter – Which is right for Your Cross-Platform App Development?

With the growing popularity of mobile applications, almost every business requires out-of-the-box mobile applications to stay competitive in the market. Therefore, businesses have started embracing cross-platform solutions instead of native solutions to craft iOS and Android applications faster, utilizing a single language.

You might have heard a lot of buzz about two cross-platform mobile frameworks — React Native and Flutter. 

React Native by Facebook and Flutter by Google are the two popular cross-platform app development technologies that are being used to build thousands of mobile apps today.

Both React Native and Flutter are currently very popular among developers who want to create high-quality and robust native applications for the Android and iOS operating systems, without spending much time and effort. 

Which one to choose-React Native or Flutter? 

This is a constant question that developers often try to solve. So let us help you make understand the differences between the two and also explore which works best for your project.

React Native vs. Flutter

User Interface

When it comes to application user interface and component creation, there is a huge difference between React Native and Flutter.

React Native makes the use of native user interface (UI) components that allow you to build your UI with isolated components or libraries. You can access a wide range of libraries that are updated on a regular basis. 

Flutter uses proprietary gadgets. They are similar to components and are easy to learn if you have some experience with the React or Angular components. 

Flutter offers you a larger set of user interfaces that could be what would make you choose it over React Native. 

Development Time

React native has remained one of the most trusted frameworks for developing the next generation of mobile applications. Because of its efficiency, it is highly preferred by the developers as it requires less time for project development.

Flutter development takes more time than React Native. The ready-to-use components of React Native speed up the development process, expanding the scope of mobile application development. 

Performance

Flutter vs. React native performance mapping is the best way to determine which framework is ideal for mobile application development. The reason why Flutter vs React Native stands out from another framework is due to the Dart (class-based, object-oriented language, and client-optimized programming language for fast apps on multiple platforms) framework. In addition, the JavaScript layers assist them to connect with native components easily.

Alternatively, React Native has a larger fan base and community. However, developers are aware of the problems they face when creating hybrid applications. However, native applications adapt well to these requirements. Under this framework, developers will not have any problems while developing applications in their native environment.

Developers sometimes experience problems using the React Native hybrid application architecture. While Flutter makes it easy for developers to reuse existing code, the C ++ engine works perfectly and supports language, which is why Flutter wins the battle hands down here!

Reusable Code

Both React Native and Flutter support reusable code that means developers can write the code once and use it on any other platform. This is what makes them a cross-platform framework. However, it is understandable that not all code can be easily transferred from one platform to another. Parts of the code can be reused and other parts need to be rewritten in a personalized way to fit the platform.

Flutter allows developers to easily rewrite pieces of code that need to be fixed to fit on the platform, making code reuse more effectively and precisely. This makes Flutter very useful for reusing code, making it a faster and more efficient framework.

React Native also allows code reuse, but with limitations. Only a few major components can be reused across platforms, while the rest must be written separately for each platform. Element styling and many other finer nuances must be adjusted manually which makes the process a little slower and tedious.

So, Flutter wins here again.

Documentation & Toolkit

Processing documentation is very complicated and time-consuming. However, Flutter is really very good at making documentation, simplifies the lives of mobile application developers, and allows them to use while documenting their applications. Therefore, Flutter is the best choice than its other competing frameworks in terms of documentation and tools.

The documentation process with React Native is not so managed and organized. In addition, the framework removes components that are useful to make the operation smooth. Therefore, it is clear that the tools bring strong competition between the two frameworks. Flutter has extensive IDEs and tools with React Native support. Visual Studio and Android Studio code compatibility improve the framework. Hence, Flutter is an appropriate winner here.

Final Wrap

As you might have noticed, React Native and Flutter have established themselves as effective and mature cross-platform frameworks. You can choose one of them and make a powerful application that works seamlessly on all major platforms. 

What’s important is what you’re compatible with. If you have experience with React or JavaScript, you will find that React Native is easy to learn. But if you are new, Flutter is a newer and clearer framework that would be worth a try.

Do you want to develop applications faster? Confused between React Native and Flutter for your application development project? Contact us and our Certified mobile application developers will help you create the perfect application for your business.

Differences between Salesforce Import Wizard and Data Loader

Differences between Salesforce Import Wizard and Data Loader

Today, Salesforce is a top-rated and most popular CRM used for transforming businesses across the globe. It provides a number of tools and functionalities to help us deliver the best and personalized service to the customers. In order to use Salesforce, one must know how to update, migrate and export data from Salesforce efficiently. There are a number of tools that Salesforce Administrations and developers can use to import data within Salesforce. These tools are available in both Salesforce Classic and Salesforce Lightning editions.

Import tools

Salesforce offers two main tools for importing external data into Salesforce.

Data Import Wizard – Salesforce provides an in-built Data Import wizard that is accessible through the Setup menu and can help you to import accounts, campaign members, person accounts, leads, custom objects, and contacts. This wizard is a step-by-step process that can take data to your desired location and displays error messages to change the potential duplicates of records.

It provides an easy interface and self-explanatory wizard to load the data into Salesforce. You can perform import operation from this wizard but delete and insert operations cannot be performed through this wizard. Data import wizard doesn’t allow to load the duplicate records and all fields can be individually mapped by this wizard within Salesforce.

Data Loader – Data Loader is the most efficient tool that is used to move data rapidly into the platform. The tool provided by Salesforce helps perform insert, update and delete operations on Salesforce records. It enables you to interact with your data within Salesforce across all objects. 

Data loader can help in various ways such as:

  • Inserting data from one system to another upon the initial implementation of Salesforce
  • Updating bulk records with new data
  • Deleting bulk records that aren’t required anymore
  • Exporting data to other systems 
  • Create a backup of previous data

In the process of data importing, Data loader reads, extracts, and loads data from Comma separated value (CSV) files or from database connections. While in the process of data exporting, the output is CSV files.

We can use Data loader in these two ways:

  1. Command line
  2. User Interface

Features of the Data Loader

  • Easy-to-use tool to offer a great interaction with data.
  • Command line interface for performing automated operations.
  • Support and manage the excess amount of data.
  • Drag-and-drop functionality is used for mapping fields.
  • It can be used to streamline data in both Salesforce and Database.com.
  • Error log files in CSV format.

Key Differences between Data Import Wizard and Data Loader 

Data Import Wizard Data Loader
For simple imports of data For complex imports of data
It can load up to 50,000 records. It can load up to 5,00,000 records.
It supports all the custom objects and only a few standard objects like Account, Contact, Campaign members, person accounts, Leads, and Solution. It supports all custom and standard objects.
It supports schedule export. It doesn’t support scheduled export.
Delete operation is not available.  Delete operation is available.
Cannot import cases and opportunity. Can import cases, events, tasks, and opportunities
While importing, duplicates can be ignored. While importing, duplicates cannot be ignored.
It doesn’t require installation. It requires installation.

Things to follow before importing Salesforce Data

  • Use existing software for exporting a file.
  • Clean up the import file for data consistency and accuracy in order to update data to highlight the duplicates, remove unnecessary information, correct spelling and resolving errors.
  • Compare your data fields with Salesforce fields for importing data into it and verify that it can be mapped into suitable Salesforce fields. 
  • Perform any configuration changes if required in Salesforce to manage the imported data. Changes you might need to perform are:  create new custom fields, add new value to picklists, or deactivate workflow rules temporarily.

Steps to import Data using Data Import Wizard

Step 1: Login into Salesforce.

Step 2: From Setup, enter “Data Import Wizard” in the Quick Find box, then select Data Import Wizard.

Step 3: Click on the Launch Wizard button.

Step 4: Select the type of data that you like to import. Click on Standard Objects tab to import accounts, contacts, leads or Click on Custom Objects to import custom objects.

Step 5: Choose the operation you need to perform- To add new records to Salesforce, update existing records, or add new records and update existing ones. 

Step 6: Select the data file you want to import data

Step 7: Click Next. A page appears where you can map the data fields in the CSV file to Salesforce data fields.

Step 8: Click Map to the left of each un-mapped field.

Step 9: Choose the Salesforce fields you want to map to and click Map.

Step 10: To change the mappings, click Change to the left of the mapped field, then select the Salesforce fields you want to map to and click Map.

Step 11: Click Next.

Note: Check your imported information. If any un-mapped fields are still remaining that you want to import, you can click Previous to return to the previous page and specify your mappings.

Step 12: Click Start Import.

Note: You can see the status of your import- From Setup, enter “Bulk Data Load Jobs” in the Quick Find box, then select Bulk Data Load Jobs.

Insert, delete and update operations by Salesforce Data Loader

Log in to your salesforce

Go to setup-> Data management ->data loader

Download Data Loader in your machine.

To log in to the data loader choose any operation and log in by providing credentials. If you are log in to Production you need to provide “Password+security token” in the password field.

The main operations you can carry out with the Data Loader

Insert – Insert new records into Salesforce

Update – Make changes to existing records within Salesforce

Upsert – Updates a record if it already exists, or inserts a new record

Delete – Deletes records from the system

Hard Delete – Delete option stores information in the Recycle Bin for a limited period, Hard Delete will remove permanently

Export – Export information from the system into a CSV format

For Inserting records

Step 1: Click on the insert button and login with your credentials and provide “your org password + security token”.

Step 2: Click on NEXT 

Select the object you want to insert the records and choose the .csv file you want to upload.

Note: Data loader allow only .csv files.

Step 3: Map the fields using drag and drop features.

Step 4: Click on ok or save the mapping

Step 5: Click on NEXT and then click on Finish. 

After inserting the records it will display error files and success files.

For updating records

Step 1: Click on the update option and log in.

Step 2: Select the CSV file contains updated records with IDs and select the object and complete the operation.

For Exporting the data

Step 1: Click on the export button and login with your credentials.

Step 2: Select the object you want to export data and specify the folder where you want to save the exported file.

Step 3: Finish the operation.

For deleting the data

Step 1: Click on the delete button and login with your org credentials.

Step 2: Select the object you want to remove the data. And select the CSV files with record IDs you want to remove.

Step 3: Map the ID field and then complete the operation.

For Hard Delete

Hard delete means deleting the data permanently from the Org. That means data will not be stored in recycle bin. 

To enable this button you need to enable bulk API. To enable the bulk API button 

Go to data loader settings and then enable the bulk API checkbox.

After using Data Loader, a window will appear that will show the results about how many new records created, updated or deleted, depending on what operations you want to perform.

About Us

Cloud Analogy, a Salesforce development company, and a Salesforce consulting partner offers a wide variety of integration and development services to the end users as well as to the clients worldwide (India, UK, USA, and Australia). We offer high-quality and customized Consultation, Configuration, Implementation and support services using the latest tools and technologies. 

Feel free to contact us at www.cloudnalaogy.com

Introduction to Constructor in Apex Programming

Introduction to Constructor in Apex Programming

Apex is a strongly typed, object-oriented programming language that is designed to handle large amounts of data. Constructor in Apex Programming is a code that is called when an object is created from the class. 

Properties of Constructor 

  • Method name should be the same as the Class name.
  • Access specifiers should be defined as public.
  • This method is called automatically when the objects are created.

Constructor Definition Syntax

public class New

{

   \\ the no argument Constructor

    public New()

     {

       \\code

     }

}

Types of Constructor

  • Default Constructor/Non-parameterized Constructor.
  • Copy Constructor 
  • Parameterized Constructor.

Default Constructor

The default constructor doesn’t contain any parameters. It is used to initialize every object with the same data.

If an Apex Class does not have any constructor, then Apex Compiler creates a dummy constructor with the name similar to the class name when an object is created for the class.

For example:

public class Test

 {

 }

 Test t = new Test();

Parameterized Constructor

A parameterized constructor contains one or more parameters(the list of arguments). It is used to initialize each object with different data.

Copy Constructor

The copy constructor is a constructor that creates an object by initializing it with an object of the same class that has been created previously. 

Uses of copy constructor:

  • Initialize one object from another of the same type.
  • Copy an object to pass it as an argument to a function.
  • Copy an object to return it from a function.

Constructor Chaining

Constructor Chaining is the process of calling one constructor from another constructor within the same class.

The main advantage of Constructor Chaining is that you can pass parameters with a bunch of different constructors, but the initialization should be done at a single location. This enables you to maintain your initialization from a single location while providing multiple constructors to the user.

Constructor Chaining can be done in two ways:

  • Within the same class: It can be done using this() keyword for constructors in the same class.
  • From base class: Using super() keyword to call a constructor from the base class.

Constructor Overloading

Constructor Overloading is a concept of having more than one constructor with different parameters list, in such a way so that each constructor performs a different task.

Syntax:

class class-name

{

Access Specifier:

Member-Variables

Member-Functions

public:

class-name()

{

// Constructor code 

}

class-name(variables)

{

// Constructor code 

}

other Variables & Functions

}

Conclusion

A constructor in Apex programming is a special method that is used to create and initialize an object within a class.

If you want to know more about how to get started with Constructor, contact our Salesforce Certified developers now.
At Cloud Analogy, our certified developers will assist you to get the advantage of different types of constructors and will help you understand the coding basics of Apex programming.

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.