Wednesday 13 March 2019

Pagination within Salesforce

Pagination is the process of taking a complete document or a large number of records in this example and breaking that document/large number of records into separate pages for viewing within the Salesforce. For example, let’s say we want to display a list of records that only shows 10 records within each page rather than a huge set within Salesforce. The Salesforce user can click the next tab and go through each new page display the next 10 records.
Here is the controller which makes use of standard set controller for pagination.
public with sharing class Pagination
{
Public Integer noOfRecords{get; set;}
Public Integer size{get;set;}
public ApexPages.StandardSetController setCon {
get{
if(setCon == null){
size = 10;
string queryString = ‘Select Name, Type, BillingCity, BillingState, BillingCountry from Account order by Name’;
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size);
noOfRecords = setCon.getResultSize();
}
return setCon;
}set;
}

Public List<Account> getAccounts(){
List<Account> accList = new List<Account>();
for(Account a : (List<Account>)setCon.getRecords())
accList.add(a);
return accList;
}

public pageReference refresh() {
setCon = null;
getAccounts();
setCon.setPageNumber(1);
return null;
}

public Boolean hasNext {
get {
return setCon.getHasNext();
}
set;
}
public Boolean hasPrevious {
get {
return setCon.getHasPrevious();
}
set;
}

public Integer pageNumber {
get {
return setCon.getPageNumber();
}
set;
}

public void first() {
setCon.first();
}

public void last() {
setCon.last();
}

public void previous() {
setCon.previous();
}

public void next() {
setCon.next();
}
}

Using the above controller methods we can define the pagination.
apex:page controller=”Pagination”>
<apex:form >
<apex:pageBlock id=”pb”>
<apex:pageBlockTable value=”{!Accounts}” var=”a”>
<apex:column value=”{!a.Name}”/>
<apex:column value=”{!a.Type}”/>
<apex:column value=”{!a.BillingCity}”/>
<apex:column value=”{!a.BillingState}”/>
<apex:column value=”{!a.BillingCountry}”/>
</apex:pageBlockTable>
<apex:panelGrid columns=”7″>
<apex:commandButton status=”fetchStatus” reRender=”pb” value=”|<” action=”{!first}” disabled=”{!!hasPrevious}” title=”First Page”/>
<apex:commandButton status=”fetchStatus” reRender=”pb” value=”<” action=”{!previous}” disabled=”{!!hasPrevious}” title=”Previous Page”/>
<apex:commandButton status=”fetchStatus” reRender=”pb” value=”>” action=”{!next}” disabled=”{!!hasNext}” title=”Next Page”/>
<apex:commandButton status=”fetchStatus” reRender=”pb” value=”>|” action=”{!last}” disabled=”{!!hasNext}” title=”Last Page”/>
<apex:outputText >{!(pageNumber * size)+1-size}-{!IF((pageNumber * size)>noOfRecords, noOfRecords,(pageNumber * size))} of {!noOfRecords}</apex:outputText>
<apex:commandButton status=”fetchStatus” reRender=”pb” value=”Refresh” action=”{!refresh}” title=”Refresh Page”/>
<apex:outputPanel style=”color:#4AA02C;font-weight:bold”>
<apex:actionStatus id=”fetchStatus” startText=”Fetching…” stopText=””/>
</apex:outputPanel>
</apex:panelGrid>
</apex:pageBlock>
</apex:form>
</apex:page>

Enjoy! If you have any questions, Talk to our team at Tecnovators, a one-of-a-kind Salesforce consulting partner delivering pay-as-you-use On-demand services for Salesforce.
Also, you can give us a call at 313-209-7137  or email us at info@tecnovators.com

Difference between master-detail relationships and lookup relationships



Master-detail relationship
Lookup relationship
You can define master-detail relationships between custom objects or between a custom object and a standard object (standard object must be the parent).You can define a relationship between any two objects, standard or custom.
When a record in a master object (parent) is deleted, all the records in the detail object (child) that are related to that master record will be deleted.When a parent object is being deleted, you can configure a child object to either clear the parent record value in the child record or prevent deletion of the parent record.
All child records must have a related parent record.The parent record may not require a related parent record.
The ownership of the child record is determined by the related parent record. Child records do not have an owner.Each child record has an owner and is not related to the parent record.
The detail record inherits sharing and security from the master record.There is no security or inheritance between related parent and child records.
To relate an object to another object, no records should exist in the child object.To relate an object to other objects, there is no condition on the number of records.
If you have the Roll-Up Summary field in the parent object, and create, edit, or delete action in the child record will trigger an edit action in the parent object. If you have a validation rule and other rules in the parent object, the validation rules will trigger for the parent object.You cannot create the Roll-Up Summary field in the lookup relationship using out-of-the-box Salesforce functionality.
Supports cross-object workflow. You can configure a field update action to update a field in the parent record using a value from the child record.Does not support cross-object workflow.

To create a master-detail relationship for an existing object with records as the child object, you can initially define it as a lookup relationship, populate all parent fields for all records, and then change the relationship to a master-detail relationship.
You can build a many-to-many object relationship using two master-detail relationships in a single custom object, which is known as a junction object in that case.

Share with us in the comments section below. And to upgrade your Salesforce Org with latest features and updates, Talk to our team at Tecnovators, a one-of-a-kind Salesforce consulting partner delivering pay-as-you-use On-demand services for Salesforce.
Also, you can give us a call at 313-209-7137 or email us at info@tecnovators.com

Tuesday 12 March 2019

Salesforce Data Migration – Read before you do Migration



Salesforce Data Migration – Imagine if you were traveling to an exotic new destination for the holidays. You want to make sure that everything is perfect and that nothing goes wrong. You might want to take all the precautionary measures – get travel insurance, have emergency info at hand and make sure that you pack all the necessary things without leaving anything behind. You know there could be nothing worse than reaching the airport only to realize that you forgot your passport – Sigh! But you also know that with careful planning and preparation, you can avoid these hassles and make your vacation a safe and complete one.
Just like traveling from one place to another, migrating data from one place to another be it from Excel Spreadsheets or Legacy systems to cloud, needs utmost care and caution throughout the scope of migration in order to avoid any mishaps. And ensuring practical safety tips might just save you from the glitches in your Data Migration plans. So, here’s a quick 6-point checklist – your passport to a safe and successful Salesforce Data Migration journey.
6-point Checklist for Successful Salesforce Data Migration
  1. Engage the Stakeholders: It is critical that you involve your stakeholders and inform them well in advance before migration to ensure that you gain maximum support for the project. Stakeholders from different teams and departments have profuse knowledge of the data and can give actionable insights pertaining to your Salesforce Data Migration plan.

  1. Identify the Data to be Migrated: Stakeholders are aware of the most crucial data and clarify your uncertainties regarding the data structure, the place of storage if it has any duplications and its effect on the Salesforce Data. It might require you to create new or appending current data fields, validations and field values in Salesforce.

  1. Create a Backup – Most importantly, create a data backup to perform a rollback to recover from any possible errors. With a Data Backup, you can be double sure that you can go ahead with the migration process, so if at any stage there is an issue, you know you have the original data to fall back on.

  1. Prepare Data for Error-free Data Migration: After deciding on the changes to be done in step 2, now you can make the necessary adjustments to ensure error-free Salesforce Data Migration process. You can add or modify objects, fields, workflows, and validations.

  1. Run a Test Migration: You don’t want to back out after importing all the data into the system. So, to avoid risking data in production, it is highly recommended that you run the test in a Sandbox environment to fix possible issues.

  1. Migrate Data: The test Migration gives you the confidence to migrate data into the production environment. Inform your stakeholders about the changes and how it will affect them prior to migration. Post your Salesforce Data Migration process, it is crucial that you validate the data.

HAVE QUESTIONS? Call us 24/7: +1 313-209-7137 Email : info@tecnovators.com
CONTACT: 
USA
#53155, Main Street, Suite, #2300 L, Novi, MI 48375.
INDIA
No: 177, Raheja Towers, 4th Floor, Beta Wing Unit No: 409, Anna Salai, Chennai, Tamil Nadu 600002.

Salesforce Spring ’19 Release – Top 10 Features


The Salesforce Spring ’19 Release is here, and you’ll now be able to explore the exciting new features and upgrades of the newest release. Here is a quick overview of Salesforce Spring ‘19 release date, our most loved features in the Salesforce Spring ’19 Release, like the advanced Lightning Experience features, Deals Cadences, Flow Builder, Lightning Web components and much more.
For complete details on Salesforce Spring ‘19 Release date, click here.
Sell Faster and Better – Salesforce Spring ‘19 Release Features
  1. Sell more with Sales Cadences
Sales Cadence is one of the most popular tools in the Salesforce Spring ’19 release for its high efficiency in offering some of the best practices to follow up with high-quality leads. This may include calling the lead, then to follow up with an email, then checking in with them five days later until they hit you up. The High-Velocity Sales feature enables you to create frictionless Cadences that allow sales reps to track what their next action ought to be.
  1. Build Quicker, Simpler, and More Intuitive Flows with Flow Builder
Flow-building just got better with the all-new Flow Builder in Salesforce Spring ’19 release! The previous Cloud Flow Designer has now been replaced with the much faster and efficient Flow Builder. It is designed with four key design principles to enhance the Flow Building Experience – Clarity, Efficiency, Consistency and Beauty.  Its simplified User Interface streamlines the process of Flow Building that enables you to slickly choose the right resource for your flow. For instance, the data elements are consolidated, so you don’t need to keep track of whether you need to use Fast Create / Record Create or the type of variable that you need.
Here’s what you need to do to migrate from Cloud Flow Designer to Flow Builder: nothing!
The flows will continue to run as they did before. All flows created in the Cloud Flow Designer will seamlessly open in the brand-new Flow Builder. Whenever you make modifications and save a flow in Flow Builder, it is saved as the new version of the flow. And the original version is not overwritten.

HAVE QUESTIONS? 
Call us 24/7 
+1 313-209-7137 
Email : info@tecnovators.com