Salesforce Certified Application Architect

Tuesday 27 August 2019

Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam

How to pass Salesforce Certified Data Architecture and Management Designer Exam

This exam was 1st architect exam for me.
Its not that much easy if we compare it with Sharing and Visibility Exam.
But if you do good preparation and practise and study all topics mentioned in resource guides,
then you can easily crack it. Good understanding of data and security/sharing model in an LDV (large data volume) environment
and best practices around LDV migration are required for preparing for the exam. Following are most important topics:


Image result for application architecture certification new logoSalesforce Certified Data Architecture and Management Designer Exam
  • Large Data Volumes (LDV)
  • Skinny Tables
  • Indexes
  • Data Loading(LDV)
  • Data Quality

Large Data Volumes (LDV)


There are a number of questions concerning that issue. Basically when you hit 2 million records threshold we can start talking about LDV. There are some areas that may be affected by such an amount of records:
  • Reports
  • Search
  • Listviews
  • SOQL

To have a better overview of the topic I strongly recommend going through Salesforce’s Best Practices for Deployments with Large Data Volumes ebook.
There is a nice chapter devoted to the database architecture. It’s quite eye opening in terms of how data is stored, searched and deleted in Salesforce:
database
There are some key challenges connected with LDV:
  • Data Skew – each record shouldn’t have more than 10k children; data should be even distributed
  • Sharing Calculation Time – one can defer sharing calculation when loading big chunks of data into system
  • Upsert Performance – better to seperately insert and then update records; upsert is quite expensive operation
  • Report Timeouts
    • Apply selective report filtering
  • Non-Selective Queries (Query Optimization)
    • Make query more selective: reduce the number of objects and fields used in a query
    • Custom Indexes
    • Avoid NULL values (these are not indexed)
  • PK Chunking Mechanisms
  • Data Reduction Considerations:
    • Archiving – consider off-platform archiving solutions
    • Data Warehouse – consider a data warehouse for analytics
    • Mashups – real-time data loading and integration at the UI level (using some VF page)

Skinny Tables

Skinny tables are quite an interesting concept that I was not aware of before.
Salesforce creates skinny tables to contain frequently used fields and to avoid joins, and it keeps the skinny tables in sync with their source tables when the source tables are modified. To enable skinny tables, contact Salesforce Customer Support. For each object table, Salesforce maintains other, separate tables at the database level for standard and custom fields. This separation ordinarily necessitates a join when a query contains both kinds of fields. A skinny table contains both kinds of fields and does not include soft-deleted records. This table shows an Account view, a corresponding database table, and a skinny table that would speed up Account queries.
skinny_table

Indexes

Indexes Salesforce supports custom indexes to speed up queries, and you can create custom indexes by contacting Salesforce Customer Support.
The platform automatically maintains indexes on the following fields for most objects.
  • RecordTypeId
  • Division
  • CreatedDate
  • Systemmodstamp (LastModifiedDate)
  • Name
  • Email (for contacts and leads)
  • Foreign key relationships (lookups and master-detail)
  • The unique Salesforce record ID, which is the primary key for each object
Salesforce also supports custom indexes on custom fields, with the exception of:
  • multi-select picklists
  • text area (long)
  • text area (rich)
  • non-deterministic formula fields (like ones using TODAY or NOW)
  • encrypted text fields.
External IDs cause an index to be created on that field, which is then considered by the Force.com query optimizer. External IDs can be created on only the following fields:
  • Auto Number
  • Email
  • Number
  • Text

Data Loading

You have to know ways to integrate Salesforce with data from external systems:
  • ETL Tools
  • SFDC Data Import Wizard
  • Data Loader
  • Outbound Messages
  • SOAP and REST API
This is crucial here to know a little bit about Bulk API.
Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, insert, update, upsert, or delete many records asynchronously by submitting batches. Salesforce processes batches in the background.
Interesting fact is that Data Loader can also utilize Bulk API. You just have to explicitly switch it on in the settings:
bulk_settings
Source: https://developer.salesforce.com/page/Loading_Large_Data_Sets_with_the_Force.com_Bulk_API
Behind the scenes Bulk API uploads the data into temporary tables then executes processing of the data (actual load into target objects) using parallel asynchronous processes:
bulk_overview
Source: https://developer.salesforce.com/page/
Loading_Large_Data_Sets_with_the_Force.com_Bulk_API
As mentioned in the LDV section you have to keep in mind few things when uploading data:
  • Disable triggers and workflows
  • Defer calculation of sharing rules
  • Insert + update is faster than upsert
  • Group and sequence data to avoid parent record locking
  • Tune the batch size (HTTP keepalives, GZIP compression)

Data Quality

There is some nice overview from Salesforce – 6 steps toward top data quality:
  • Use exception reports and data-quality dashboards to remind users when their Accounts and Contacts are incorrect or incomplete. Scheduling a Dashboard Refresh and sending that information to managers is a great way to encourage compliance
  • When designing your integration, evaluate your business applications to determine which one will serve as your system of record (or “master”) for the synchronization process. The system of record can be a different system for different business processes
  • Use Workflow, Validation Rules, and Force.com code (Apex) to enforce critical business processes
  • Use in-built Salesforce Duplicate Rules and Matching Rules mechanisms
You can find more info about Data Management Plan on Trailhead.
Other imporant terms:
  • Data Governance – refers to the overall management of the availability, usability, integrity, and security of the data employed in an enterprise. A sound data governance program includes a governing body or council, a defined set of procedures, and a plan to execute those procedures
  • Data Stewardship – management and oversight of an organization’s data assets to help provide business users with high-quality data that is easily accessible in a consistent manner




 

Friday 12 July 2019

How to listen to Salesforce Platform Events from MuleSoft?

Platform Event in Salesforce:

 


Sample Flow:


 


Replay Channel:


 



Transform Message:


 




Logger:


 


Code to execute in Developer Console:


Below code is used to create an event record so that MuleSoft can get notified.  
  
  1. Sample__e objEvent = new Sample__e( Status__c = 'Testing' );  
  2. EventBus.publish( objEvent );  


Output:


    

Getting Started With MuleSoft

What is Mule?

Mule, the runtime engine of Anypoint Platform, is a lightweight Java-based enterprise service bus and integration platform that allows developers to connect applications together quickly and easily, enabling them to exchange data.

What is middleware.

Software that acts as a bridge between and operating system or database and applications, especially on a network.

What is SOA?

Service Oriented Architecture is a set of principles and methodologies to design and develop well-defined business functionalities that are built as software components that can be reused.

What is an ESB?

An Enterprise Service Bus implements a communication system between mutually interacting software applications in a service-oriented architecture(SOA).

What is an API?

An API defines what you can call, what you send it, and what you get back.

What is a Web Service?

The actual API implementation you can make calls to or the interface of that API implementation.
A web service is a method of communication that allows two software systems to exchange data over the internet.

What is an API Proxy?

An application that controls access to a web service, restricting access and usage through the use of an API gateway.

What are the parts of a web service?

i. Web Service API
Describes how you interact with the web service.
ii. Web Service interface implementing the API
Is the code providing the structure to the application so it implements the API.
iii. The Web Service implementation itself
Is the actual code and application.

Define JSON?

A lightweight data-interchange format.

What is an API Portal?

When a REST API is added to Exchange, an API portal is automatically created for it.

An API portal has
i. Auto-generated API documentation
ii. An API Console for consuming and testing APIs
iii. An automatically generated API endpoint that uses a mocking service to allow the API to be tested wthout having to implement it.

REST Connectors in Anypoint Exchange

When a RAML 1.0 API specification is added to Exchange, a connector is automatically created for it.
i. The connector can be used in Mule applications to make calls to that API.
ii. REST Connect is the name of the technology that performs this conversion.

Flow Designer

Web app for building integration apps that connect systems and consume APIs.

API Designer

Web app for designing, documenting and mocking APIs.

Anypoint Studio

Desktop IDE for implementing APIs and building integration applications.

MUnit

MUnit is a Mule app testing framework for building automated tests.
MUnit is fully integrated with Anypoint Studio.

RAML

RESTful API Modeling Language.
A simple, strutured and succinct way of describing RESTful APIs.
RAML files can be used to auto-geerate documentation, mocked endpoints, interfaces for API implemenations and more.

RAML Syntax

RAML is based on broadly-used standards such as YAML and JSON.
Uses a human-readable data serialization format where data structure hierarchy is specified by indendation.

Friday 28 June 2019

What is the most efficient way in Visualforce to show information based on data filters defined by an end-userfor a large volume of data?

A. Use an Apex controller to refine raw data based on data filters and store the result in a transient variable.
B. Use an Apex controller to refine raw data based on data filters and store the result in a snauc variable.
C. Use the rendered condition in Visualforce to limit data based on data filters.
D. Use filter conditions in a SOQL query to limit data based on data filters.

Ans: D. Use filter conditions in a SOQL query to limit data based on data filters

What is the optimal functionality in the Developer Console to count the number of calls made to themethod? A developer has a Debug method within a class, which is invoked hundreds of times.

A. The “Execution Log” Panel.
B. The “Execution Stack” Panel.
C. The “Executed Units” tab under the Execution Overview Panel.
D. The “Execution Tree” tab under the Stack Tree Panel.
This question is part of PD2

Ans : The “Executed Units” tab under the Execution Overview Panel

Friday 16 March 2018

Type of events into Salesforce Lightning component

1. What are the type of events into Salesforce Lightning component?
a. Application Event – Scope of this event is throughout the lightning App and any component which has registered for this event would get a notification.
b. Component Event– Scope of this event is within itself or the parent component of this event, all the components declared within the parent component would get notified of this event.
c. System Event- these are the events fired by Salesforce’s system during the lifecycle of the lightning app.
2. What are the basic differences between Application Event and Component Event?
Component events are used to do communication between child and parent. They use bubbling and capture same as used in DOM events. A change in a child component can be communicated to the parent component via component event.
Application events are used to communicate any change in the component to a broader audience. Any component who has registered for this event will get a notified.
To use Component Event API we use the below syntax

Thursday 8 February 2018

System.LimitException: Apex CPU time limit exceeded

The Apex CPU time limit exceeded error is a standard Salesforce error which occurs when the salesforce governor limit to run the Apex code has exceeded.The maximum CPU time to run the Apex code on the Salesforce servers is:
  • ​10,000 milliseconds (Synchronous limit)  
  • 60,000 milliseconds (Asynchronous limit)
below are the methods where we can get the CPU time and CPU limit.

Limits.getCPUTime() - Returns the CPU time(in milliseconds) accumulated on the salesforce.com server in the current transaction.

Limits.getLimitCPUTime() - Returns the total CPU time (in milliseconds) accumulated on the salesforce.com servers in the current transaction.


Example :

 Below code error is coming due to FOR inside FOR loop.
Set<String> setDependantValue = new Set<String>();
        for(Payment_Process__c objPicklistValues : lstProduct_Line){
            setDependantValue.add(objPicklistValues.Payment_Name__c);
        }
        Map<String, List<String>> mapDependantControllingValue = new Map<String, List<String>>();
        for(String objDepVal : setDependantValue){
            List<String> lstControllingValues = new List<String>();
            for(Payment_Process__c objPicklistValues : lstProduct_Line){
                if(objDepVal == objPicklistValues.Payment_Name__c){
                    lstControllingValues.add(objPicklistValues.Product_Family_Name__c);
                }
            }
            mapDependantControllingValue.put(objDepVal, lstControllingValues);
        } 


Solution : 
 Issue is resolved by following optimized code.
 Map<String, List<String>> mapDepValContVal = new Map<String, List<String>>();
        for(Payment_Process__c prdLine : lstProduct_Line){
            List<String> lstControllingValues = mapDepValContVal.get(prdLine.Line__c);
            if(lstControllingValues == null)
                lstControllingValues = new list<String>();
            lstControllingValues.add(prdLine.Family__c);
            mapDepValContVal.put(prdLine.Line__c, lstControllingValues);
        } 

Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam

How to pass Salesforce Certified Data Architecture and Management Designer Exam This exam was 1st architect exam for me. Its not that muc...