Monday 11 March 2019

Export Salesforce Apex Test Coverage

Salesforce is a very dynamic platform which provides us(Developers - wink :P) different ways to accomplish the tasks. The sole choice lies with the developer to adapt the method in such a way to perform the task in an automated fashion. 

Problem Case:

The main block which everyone doesn't like(as per the feedback from my friends) is the Apex Test Coverage as it hinders the developers to deploy to other instance(although it is a best practice to write the test coverage above 85%) but what if when we are working on a project where we are dealing with huge no of apex classes, how to deal with the coverage of so many classes. Unfortunately, Salesforce do not provide us a direct way where we can export it in portable format. Here in this post i will try to explore new technique by which we can export the Latest Org Test Coverage.


Pre-Requisites:
1) The Apex page and Apex class should be present in Org(Our technique to export the coverage in excel)
2) We should have executed Run All Test in Org before exporting coverage
3) The Admin user should be used to export the results

Solution:
Salesforce exposes the Test coverage results on classes through Tooling REST API, hence there are many ways to consume the API and create our utilities such as - create java based code to connect to SF and get results in local to parse the response. Here is my case, I have developed a Salesforce VF page which is rendered as excel doc after querying & parsing Response from Salesforce Tooling API to fetch coverage results.

API details:
/services/data/v43.0/tooling/query/?q=Select+id,ApexClassorTrigger.Name,NumLinesCovered,NumLinesUncovered+from+ApexCodeCoverageAggregate+order+by+ApexClassorTrigger.Name

In above query, we are querying results from "ApexCodeCoverageAggregate" and fetching the response to parse it into table(with some obvious calculations).

Code:
SFDC_ExportTest - GitHub Repo

Monday 11 February 2019

Agile Methodology




What is Agile Methodology and why use it?

There have been a lot of hype for Agile Processes. Agile has become one of the most common and effective methods for developing and delivering software solutions to customers. 
In Development practice, we use the Agile process to run our Salesforce development and Implementation. From the beginning, we have found that Agile not only makes the most sense from an internal perspective but that it helps us deliver the best possible results for our clients.
However most of IT folks are confused about the Agile Ways of Working and proper alignment with this model while working. In this post I will try to guide you through the quick overview of Agile.

Agile VS Traditional

Agile is basically a methodology and project management concept for software development. It is an umbrella under while many different methods live. E.g. Scrum, Kanban etc.
Traditional project development can be thought of a waterfall model. It requires a thorough plan from the beginning, (which can take a lot of time) and then the different parts are developed from the top down. Which this process can deliver quality results, it has enough drawbacks that people began looking for new solutions.
Agile was introduced as a reaction to traditional method. Which everyone realized was in-efficient, wasted resources and could not deliver the needed results. Agile methods allow developers to respond quickly to changing circumstances or new requirements. Rather than running from the top down, Agile processes allow for a fluid development, often based on levels of priority, and allowing for constant re-evaluation of how the project is doing and where it is going along the way.

What are some of the benefits and characteristics of using Agile?
  • Projects are completed faster than traditional development
  • Stakeholders and clients are actively involved, which helps ensure satisfactory results
  • Agile helps us develop the right product – and not be handcuffed to a project that won’t deliver the needed results
  • Project costs are predictable and can be regularly assessed or modified.
  • Results in higher quality results
  • Ongoing development and change allow the project to continue to evolve and meet whatever new requirements may arise
  • Agile creates transparency that holds all peers accountable for their actions.
  • The agile hierarchy is based on competence, not authority 


In this post, we will be explaining 2 practices under Agile: Kanban and Scrum

Kanban

Kanban is primarily a way of organizing, visualizing and prioritizing what work is being done, and when. Kanban is always done on a ‘board’, either virtual or physical. Kanban boards are generally divided into 3 sections, “to-do”, “in progress” and “done”.



Each task that needs to be done will be placed into one of these divisions, allowing us to manage the entire project in this way. By being able to visualize everything in the scope of the project, we can prioritize what needs to be done and have an overall sense of where things are.

Scrum

Scrum is where we get our practice of using sprints to divide and organize what is always being done. Sprints often range from 1 week to 1 month, depending on the project.

At the beginning of each sprint, our team sits down, discusses what was done in the previous sprint, what needs to be done in the next sprint (based on what is remaining “to-do”), and how we are going to go about it. Once roles are assigned and everyone knows what needs to be done, the team can break and get into their individual projects.

The Scrum process has a few major benefits:
  •         It streamlines the project management process
  •         It ensures everyone has something to do
  •         It allows us to regularly evaluate what has been done, and make any changes to the scope or content of the project
  •         The entire project gets done fast!


Sunday 27 January 2019

“Android.process.media has stopped unexpectedly” error for Android Phones


The process name implies that it is related to SD card. FAT filesystem is very old and unreliable filesystem. Android stop apps to prevent further damage to your data.
Solution: Eject MicroSD card. Insert in card reader, plug to PC. Run chkdsk i: /f /x, where i- drive letter for your SD partition in Windows OS. Chkdsk shall find and fix the problem. Problem solved.

Chkdsk is very good utility command to flatten the storage disk and resolves out any issues and inconsistencies. Here are the options for chkdsk.
 chkdsk [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]]
The options and switches for Check Disk are used as follows: 
Volume Sets the volume to work with. 
filename FAT/FAT32 only: Specifies files to check for fragmentation. 
/F Fixes errors on the disk. 
/V On FAT/FAT32, this displays the full path and name of every file on the disk. On NTFS, this displays cleanup messages, if any. 
/R Locates bad sectors and recovers readable information (implies /F). 
/L:size NTFS only. Changes the log file size. 
/X Forces the volume to dismount first if necessary (implies /F). 
/I NTFS only. Performs a minimum check of index entries. 
/C NTFS only. Skips checking of cycles within the folder structure. 
-
Another command :
Diskpart (used for maintaining disk partitions)
List Disk (used for listing All disk)
Select Disk 1(used for selecting Disk 1)
Clean (The drive's partition, data, and signature is now removed. You will return to the diskpart prompt. Warning: Once you type clean and hit enter the drive will be erased. No warning will be provided.) Handle with Care!!!

File Storage on Hard Drive


To know the actual changes of hard drive after file deletion, we must know the storage of a file on hard drive at first. In Windows OS (Operating System), a hard drive is divided into 5 areas: MBR, DBR, FAT, DIR and DATA. 

mbr MBR (Master Boot Record): generated by Fdisk – the partitioning command, it is located in cylinder 0, head 0 and sector 1. When you see "55 AA", you should know it’s the end of MBR. 

dbr DBR (Dos Boot Record): generated by formatting command, it is located in cylinder 0, head 1 and sector 1. It’s the first sector that OS could have access to. It includes a bootstrap program and a BIOS parameter block. 
fat FAT (File Allocation Table): in Windows, a file is actually divided into several segments and each segment is saved into dispersed hard disk clusters. The connection information among different segments is saved in FAT. So when accessing a file, the system can find certain segments quickly and accurately according to records in FAT. 

dir DIR (Directory): this area is also known as FDT (File Directory Table), which records the information of each file (directory), such as starting & ending unit and attributes, in the root directory. 

data DATA: this is the exact place where the real content of files is stored. 

Popular Git Cammands

In today's digital modern era, Every IT company wants to use most collaborative form of development technique. Hence keeping that in mind today, i will try to cover most popular git commands which are normally used in project development.

Image result for git image


• git clone: clone a remote repository to your local.
• git add .: add all the changes in repository to staging.
• git pull : pull all branches with latest changes to your local.
• git status : to see what files have been created, modified or deleted.
• git add hello.js : to stage or simply add files.
• git reset HEAD : remove all staged files.
• git commit -m "comments" : commit the staged changes.
• git reset --soft HEAD~1 : undo your most recent commit and put those changes back into staging.
• git push : push your committed changes to a remote repository.
• git stash : save changes that you don’t want to commit immediately.
• git branch : list out all the branches.
• git checkout <branch> : switch to different branches.

Complete tutorial can also be found @ https://git-scm.com/docs/gittutorial

Monday 15 January 2018

Salesforce Certified Administrator Winter ’18 Release Q & A

1 of 5. What functionality is available to users when adding files in Lightning Experience?
 
A. Mass upload Quip documents using the data loader
B. Access an external file provider and request secure Quip access
C. Create a new Quip file and add security from a downloaded file in Chatter
D. Create, share, and collaborate on documents with Quip without an external file provider

Correct Answer : D

2 of 5. What functionality enables sales representatives to manage their own sales territories in Lightning Experience?
 
A. Advanced Territory Management
B. Community Territory Management
C. Enterprise Territory Management
D. Corporate Territory Management

Correct Answer : C

3 of 5. Which three functions are available to a Collaborative Forecast user in Lightning Experience?(Choose 3 answers)
 
A. Designate a Delegated Forecast Administrator
B. See User Quota Attainment information
C. Adjust their own Product Family Forecast
D. Access Collaborative Forecasts in Lightning Sales Console
E. Create a Locked Forecast to prevent editing

Correct Answer : B,C,D

4 of 5. The sales teams at Universal Containers need to easily access the Sales Pipeline Dashboard. How can an administrator accomplish this in Lightning Experience?
 
A. Create a cross object dashboard component and add to the record
B. Create a new object and add a dashboard component
C. Create a new component for each sales user and add to their profile
D. Create a embedded dashboard and add to the Home tab

Correct Answer : D

5 of 5. When does an emoji icon appear in the Chatter publisher in Lightning Experience?
 
A. When a user creates a new Chatter group
B. When a user creates a new Chatter Quip file
C. When a user creates a new Chatter profile
D. When a user creates new Chatter posts and comments

Correct Answer : D

Salesforce Certified Platform Developer I - Winter '18 Release Q & A



1 of 6. Which two statements are true regarding Lightning component JavaScript code validation?(Choose 2 answers)
 
A. Code validations are applied only to components set to API version 41.0 and later.
B. Code validations can be temporariy disabled by setting the component version to API 40.0 or earlier.
C. The validation service ensures good software design and prevent bugs.
D. Code validations enforce all ESlint rules.

Correct Answer : A,B

2 of 6. In which two ways does Lightning Data Service (LDS) eliminate redundant server calls in Lightning Components?(Choose 2 answers)
 
A. LDS allows each component within an app to make independent, but concurrent, calls to perform CRUD operations on the same record data.
B. LDS identifies requests that involve the same record data and sends a single shared data request that updates all relevant components.
C. LDS acts as a publisher hub that notifies components of data changes.
D. LDS can be configured as a publisher hub with simple Apex code.

Correct Answer : B,C

3 of 6. In which two ways does Salesforce DX facilitate source-driven development?(Choose 2 answers)
 
A. Salesforce DX provides an efficient, end-to-end life cycle designed for waterfall development.
B. Salesforce DX shifts the source of truth from the org to the version control system.
C. Salesforce DX allows agile, local test runs.
D. Salesforce DX provides an integrated, end-to-end life cycle designed for high-performance agile development.

Correct Answer : B,D

4 of 6. What is the correct annotation to indicate test classes that can run in parallel?
 
A. @isTest(runParallel=true)
B. @isTest(isParallel=true)
C. @isTest
D. @isTest(isParallelrun=true)

Correct Answer : B

5 of 6. Which Content Security Policy (CSP) configuration is required to access the Streaming API and call Apex methods from within a Lightning container component?
 
A. CSP set to low
B. CSP set to custom
C. CSP set to Lightning
D. CSP set to minimum

Correct Answer : A

6 of 6. What are two valid scenarios for automatic recompilation of Apex classes?(Choose 2 answers)
 
A. All Apex classes are automatically recompiled when Apex transactions are run.
B. Specific Apex classes are automatically recompiled before completing a metadata deploy.
C. All Apex classes are automatically recompiled before completing a metadata deploy.
D. All Apex classes are automatically recompiled before a package is installed.

Correct Answer : C,D

Salesforce Certified Platform App Builder - Winter '18 Release Q & A


1 of 5. How can an App Builder reference a Queue in the Lightning Process Builder?
 
A. Update Records Action Type and a value of the Queue Name
B. Build a process on Queue that finds and changes the owner
C. Use the Queue Label
D. Add a Lookup(Queue) field to the Case and set the Owner to the Queue

Correct Answer : D

2 of 5. In which way have Lightning Bar Chart Dashboard components been enhanced?
 
A. Horizontal Bar Charts can have up to four measures
B. Line Charts can have up to four measures
C. Pie Charts can have up to four measures
D. Donut Charts can have up to four measures

Correct Answer : A

3 of 5. How can an App Builder implement File privacy on records in Lightning Experience?
 
A. Enable private file settings from Salesforce Files setting
B. Add the file privacy permission to a Permission Set
C. Add the file privacy on Records field to the Files page layout
D. Add file privacy feature on Content Deliveries setting

Correct Answer : C

4 of 5. How can a App Builder add a Flow-based Customer Survey in a Customer Community?
 
A. Create a Login Flow for Community Users
B. Add a Flow Component to a Community page
C. Add a Flow Quick Action to the page layout
D. Create a Visualforce page with an embedded Flow

Correct Answer : B

5 of 5. How can an App Builder configure a Lightning Page so that a Page component only displays for Accounts in Europe?
 
A. Add a component that only supports dynamic display
B. Add a component to a new page layout for Eurpoean Accounts
C. Add filter conditions and logic to the component properties
D. Set the component visibility by Profile and Record Type

Correct Answer :  C