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)
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”
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:
- Check the debug logs and find out the SOQL limit usage and note the list of triggers, classes which have been executed so far.
- 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
- Cross-verify the SOQL queries are not used inside loop.
- 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
- SOQL for Custom Setting?
- Certified Managed Package SOQL queries Limit has their own limit (100), in addition to the native code limit.
- Revisit all the SOQL queries and try to write it more efficiently:
Below are few scenarios:
Continue reading “Debugging – 101 SOQL Limit”
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());
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”
We can create sharing rule in different ways like
- Manual Sharing and
- Apex based sharing rule.
We will concentrate on the 4th one i.e., Apex based sharing rule as the first 3 can be done by point-N-click.
What is Apex based sharing rule?
It is similar to the first 3 types of sharing rule (as mentioned above), the only difference is we will create this sharing rule programatically and along with that we can also specify the custom reason why it is being shared.
Why Apex based sharing rule?
Continue reading “Apex Share Utility”
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”
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.
Pre-requisite: Enable ‘My Domain’ in your org by following below navigation:
Continue reading “Turn On – Lightning Part 1”
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”