SSO Integration between Salesforce Orgs

SSO Integration between Salesforce Orgs

There is very good blog which explains steps-by-step about how Salesforce will be acting as both Identity Provider (IdP) and Service Provider (SP).

Requirement: Lets implement integration between IdP and SP. So, that whenever the User is Active/In-Active in IdP, the same thing should be reflected in the SP.

Solution: We will implement a batch job in IdP which makes a REST based callout to SP in order to create or update the users.

Step 1: Create connected App in Destination (in our case it is SP)

connectedAppforSSO

Step 2: Configure Client Secret, Consumer Key and the URL instance from Destination Org (SP) in Source Org (IdP)

Client Secret, Consumer Key should be configured in Custom Setting but in this example I will be directing using this in code. And the URL instance must be configured in Remote Site Settings.

Continue reading “SSO Integration between Salesforce Orgs”

Debugging – 101 SOQL Limit

Debugging – 101 SOQL Limit

Another very common governor limit is SOQL LIMIT. There are many best practices to be followed while writing efficient code. Here, is one of the link:

In this blog, I will not be explaining the best practices but I will be throwing some pointers what needs to be considered when SOQL limit is reaching:

  1. Check the debug logs and find out the SOQL limit usage and note the list of triggers, classes which have been executed so far.
  2. Verify code – Is there any multiple SOQL statements running on the same object?
    • If Yes, then make it one and segregates it using collections and then process it
  3. Cross-verify the SOQL queries are not used inside loop.
  4. Any SOQL statement for getting Recordtype?
    • If Yes, then remove it and replace with below sample code:Id recordTypeId = Schema.SObjectType.Account.RecordTypeInfosByName.get(‘RecordTypeName’).RecordTypeId;replace Account with the relevant object API name
  5. SOQL for Custom Setting?
  6. Certified Managed Package SOQL queries Limit has their own limit (100), in addition to the native code limit.
  7. Revisit all the SOQL queries and try to write it more efficiently:

Below are few scenarios:

Continue reading “Debugging – 101 SOQL Limit”

Reduce number of DML Statements

Reduce number of DML Statements

One of the most common governor limit which every developer encounter is the number of DML Statements and there are many more as well like SOQL limit which I will be explaining in my next blog.

Identify the number of DML Statements allowed per transaction?


system.debug('DML Limit ' + Limits.getLimitDMLStatements());

SF Governor Limit

150 DML statements for a transaction is more than enough, but it may hit the limit if code is not properly written.

Continue reading “Reduce number of DML Statements”

Relationship between Topics

Relationship between Topics

At present, Topic + SubTopic feature is only supported in Communities. This can be achieved by Navigational Topics where you can specify SubTopics for the relevant Topics which helps a lot in finding the relevant data.

So, how to create Topic and SubTopic? – I will not be going in detail as it can be done with just few Point-N -Clicks :), anyhow here is the link.

But I will be sharing a code snippet which gives you list of sub-topics mapped against the respective topics (you can modify as you like)

In order to achieve this, Salesforce provides a set of classes (under ConnectAPI namespace) which can be used to identify the relationship between topics and their subtopics.

Here is a list of available classes present in ConnectApi Namespace. Out of this list I will be using “ManagedTopics” and “Topics” Class.

Pre-requisite: Community should be enabled and few topics and sub-topics are created using the UI as per the link shared above.

Continue reading “Relationship between Topics”

Turn On – Lightning Part 1

Turn On – Lightning Part 1

Lightning, Lightning and everywhere Lightning is a next generation UI optimized for speed and it is instantly available from winter 16 onwards.

What is Lightning Component Framework?

  • It’s a UI Framework built on the Open Source Aura Framework for developing dynamic web apps which are readily available for mobile and desktop devices which helps us in building apps completely independent of your data.
  • It supports partitioned multi-tier component development that bridges the client and server.
  • It uses JavaScript on Client Side and Apex on Server Side.

Pre-requisite: Enable ‘My Domain’ in your org by following below navigation:

Continue reading “Turn On – Lightning Part 1”

Org Consolidation + Data Migration

Org Consolidation + Data Migration

Usually Data Migration is very crucial for any organization and apart from this if you are doing an ORG Consolidation then the complexity increases by 100 times. Org Consolidation + Data migration cannot be done in a span of 1 or 2 months. This requires a detailed analysis of both Source and Target org and a plan to execute to make this a successful.

If you are doing this activity then I will strongly suggest divide this activity into phases. Discuss with customers what they need on priority and prepare a plan about each phases what and why it is considered in the respective phases.

Take a look on this beautiful document listing best practices for Consolidating Multiple Salesforce Orgs:

Below are few Key considerations for Org Consolidation:

Continue reading “Org Consolidation + Data Migration”