<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Matheus Goncalves</title>
    <description>The latest articles on DEV Community by Matheus Goncalves (@matheusgoncalves).</description>
    <link>https://dev.to/matheusgoncalves</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F35396%2F243ba984-65d9-4092-aa50-9e3ee061a581.jpeg</url>
      <title>DEV Community: Matheus Goncalves</title>
      <link>https://dev.to/matheusgoncalves</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matheusgoncalves"/>
    <language>en</language>
    <item>
      <title>How to mock formulas and read-only fields in Apex tests?</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Fri, 25 Mar 2022 22:07:46 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/how-to-mock-formulas-and-read-only-relationships-in-apex-tests-24ld</link>
      <guid>https://dev.to/matheusgoncalves/how-to-mock-formulas-and-read-only-relationships-in-apex-tests-24ld</guid>
      <description>&lt;p&gt;&lt;em&gt;Learn how to use dependency injection to mock read-only fields, such as formula fields and child relationships in your tests.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A while ago we explored the &lt;a href="https://github.com/gitmatheus/Mock-Data-Layer-Pattern"&gt;Mock Data Layer Pattern&lt;/a&gt;, which allows us to mock virtually any relationships between records within your tests. This is especially handy when trying to improve the performance of these tests - more details &lt;a href="https://dev.to/matheusgoncalves/unit-test-can-we-mock-relationships-in-salesforce-apex-4ohb"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, how can we mock formula fields and &lt;strong&gt;read-only&lt;/strong&gt; child relationships if they are, well, read-only fields? 🤔&lt;/p&gt;

&lt;h2&gt;
  
  
  Mocking values in read-only fields
&lt;/h2&gt;

&lt;p&gt;For this exploratory project, we will use a &lt;em&gt;not-so-realistic&lt;/em&gt; scenario with parent and child accounts, but the intent is to create a test for the Account Trigger Handler that will use a &lt;strong&gt;Mock Field Reader&lt;/strong&gt; and a &lt;strong&gt;Mock Data Layer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Mock Field Reader&lt;/strong&gt; will be used so we can mock two &lt;strong&gt;read-only&lt;/strong&gt; fields on the Account object.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Child_Accounts__r&lt;/code&gt;, a read-only child relationship on the parent record&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;External_URL__c&lt;/code&gt;, a formula field on the child record&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trigger handler logic will update the following field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Parent.Latest_Child_URL__c&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Based on the following formula field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Child.External_URL__c&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚙️ Files used in this project
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;force-app
    main
        default
            classes
                ◦ AccountTriggerHandler
                ◦ AccountTriggerHandlerTest
                ◦ FieldReader
                ◦ IFieldReader
                ◦ MockFieldReader
                ◦ TestUtils
            triggers
                ◦ AccountTrigger
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚡️ Show me the code!
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Getters
&lt;/h4&gt;

&lt;p&gt;To respect the injected dependency, these methods must be present on both the real instance of the field reader ( &lt;code&gt;FieldReader&lt;/code&gt; ) and the mock instance of the field reader ( &lt;code&gt;MockFieldReader&lt;/code&gt; ).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Object getFieldValue(SObject record, String fieldName)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This method is used to retrieve the mock values of formula fields. It returns an &lt;code&gt;Object&lt;/code&gt; that can later be casted as different types, such as &lt;code&gt;String&lt;/code&gt;, &lt;code&gt;Number&lt;/code&gt;, &lt;code&gt;Id&lt;/code&gt;, etc. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;SObject getFieldRecord(SObject record, String fieldName)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This method is used to retrieve the mock values that represent a single record. It returns an &lt;code&gt;SObject&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;List&amp;lt;SObject&amp;gt; getFieldRecords(SObject record, String fieldName)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This method is used to retrieve the mock values that represent a list of records, such as a child relationship. It returns a list of &lt;code&gt;SObjects&lt;/code&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Setter
&lt;/h4&gt;

&lt;p&gt;There's only one method used to set the values, and it's only present on the mock instance of the field reader ( &lt;code&gt;MockFieldReader&lt;/code&gt; ).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;addValueToField(SObject record, String field, Object value)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This method adds the field/value pair to a map of mocked values, indexed by the record Id.&lt;/p&gt;
&lt;h4&gt;
  
  
  Examples
&lt;/h4&gt;

&lt;p&gt;In the &lt;a href="https://github.com/gitmatheus/MockFieldReader" rel="noopener"&gt;repository on Github&lt;/a&gt; you will find a trigger handler class and its respective test class with the usage of this Mock Field Reader. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Snippet from the AccountTriggerHandler&lt;/strong&gt;: pay attention to how the following methods are being used:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fieldReader.getFieldRecords(parentAndChildAccount, 'Child_Accounts__r');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fieldReader.getFieldValue(latestChild, 'External_URL__c');&lt;/code&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;And in the &lt;strong&gt;AccountTriggerHandlerTest&lt;/strong&gt; you can see how these read-only fields can be mocked, using the method &lt;code&gt;addValueToField&lt;/code&gt;: &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;With this code and the Mock Field Reader, it becomes easy to mock read-only fields used in the tests. &lt;/p&gt;

&lt;p&gt;I hope that helps!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://matheus.dev/how-to-mock-formulas-and-non-writable-relationships-in-apex/"&gt;matheus.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>apex</category>
      <category>testing</category>
      <category>performance</category>
      <category>mock</category>
    </item>
    <item>
      <title>The growth stages of a programmer</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Thu, 15 Aug 2019 21:22:04 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/the-growth-stages-of-a-programmer-49oe</link>
      <guid>https://dev.to/matheusgoncalves/the-growth-stages-of-a-programmer-49oe</guid>
      <description>&lt;p&gt;▫️ I don't know what I'm doing...&lt;br&gt;
▫️ Let me copy this code block from the Internet&lt;br&gt;
▫️ Hey, if it works, it works!&lt;br&gt;
▫️ It's working, but it needs to follow the best practices and design patterns.&lt;br&gt;
▫️ Let's refactor it!&lt;br&gt;
▫️ I don't know what I'm doing...&lt;br&gt;
▫️ Aha!&lt;/p&gt;

</description>
      <category>programmer</category>
      <category>developer</category>
      <category>engineer</category>
    </item>
    <item>
      <title>How to select the Salesforce release for a Scratch Org</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Mon, 29 Jul 2019 19:52:14 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/how-to-select-the-salesforce-release-for-a-scratch-org-485l</link>
      <guid>https://dev.to/matheusgoncalves/how-to-select-the-salesforce-release-for-a-scratch-org-485l</guid>
      <description>&lt;p&gt;Did you know you can specify the release (preview or previous) when creating a scratch org?&lt;/p&gt;

&lt;p&gt;That is especially helpful when testing your code against future features in Preview orgs, &lt;a href="https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_version_selection.htm"&gt;but it’s even more than that&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;During every major Salesforce release, you have the opportunity to get early access to the release in your scratch orgs and sandboxes to test new customizations and features before your production org is upgraded. This is called the Salesforce Preview, and scratch orgs created on the upcoming release are called preview scratch orgs.&lt;/p&gt;

&lt;p&gt;This way you not only can try out new features in an upcoming release, to check if they &lt;strong&gt;will fit your needs&lt;/strong&gt; but also by running your applications in preview orgs, you can &lt;strong&gt;proactively&lt;/strong&gt; check if your code is in good shape or if there will be a &lt;strong&gt;breaking change&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then you can add any future bug to your backlog and plan your work accordingly, with fewer surprises.&lt;/p&gt;

&lt;p&gt;Normally, you create scratch orgs that are the same version as the Dev Hub. However, during the major Salesforce release transition that happens three times a year, &lt;strong&gt;you can select the Salesforce release version&lt;/strong&gt;, Preview or Previous, based on the version of your Dev Hub.&lt;/p&gt;

&lt;p&gt;Before this change, you would have to create a trial Dev Hub on the upcoming version to create preview scratch orgs. Now you can use your existing Dev Hub that includes your existing scratch org active and daily limits.&lt;/p&gt;

&lt;p&gt;Because previous and preview are all relative terms, your Dev Hub org version during the release transition determines their relative significance. Here’s what happens when you try to create a scratch org with one of the release values.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;strong&gt;Dev Hub Version&lt;/strong&gt;&lt;/td&gt;
        &lt;td&gt;&lt;strong&gt;Preview &lt;/strong&gt;&lt;/td&gt;
        &lt;td&gt;&lt;strong&gt; Previous &lt;/strong&gt;&lt;/td&gt;        
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Dev Hub has upgraded to the latest version&lt;/td&gt;
        &lt;td&gt;Error (Dev Hub is already on the latest version)&lt;/td&gt;
        &lt;td&gt;Prior Dev Hub version&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Dev Hub is still on the GA version&lt;/td&gt;
        &lt;td&gt;Version following the Dev Hub version (newly released Salesforce version)&lt;/td&gt;
        &lt;td&gt;Error (Dev Hub is on the GA version; previous version unavailable)&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Important note: If you don’t specify a release value, the scratch org version is the same as the Dev Hub org.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Scratch Org for a Specific Release
&lt;/h3&gt;

&lt;p&gt;You can specify the release version in the scratch org definition file or directly on the command line. Any option you issue on the command line overrides what you have defined in your scratch definition file.&lt;/p&gt;

&lt;p&gt;Find out which instance your Dev Hub org is on: &lt;a href="https://status.salesforce.com/"&gt;status.salesforce.com&lt;/a&gt;.&lt;br&gt;
Add the release option to your &lt;a href="https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file_config_values.htm"&gt;scratch org definition file&lt;/a&gt;:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;If you’re planning on using some sort of script to spin up a new scratch org, or you just prefer using the command line, you can specify the release value directly on the CLI!&lt;/p&gt;

&lt;p&gt;Please note the use of the release keyword: release=Preview&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;If you’re creating a previous scratch org and you have upgraded the CLI to the pre-release version, be sure to set the apiVersion to match the scratch org version.&lt;/p&gt;

&lt;p&gt;To set it globally for all DX projects:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;To set it on the command line:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  What If I Want to Create a Pre-Release Scratch Org?
&lt;/h3&gt;

&lt;p&gt;Pre-release is a very early build of the latest version of Salesforce that’s available before Salesforce Preview. It’s not built to handle scale and doesn’t come with any Salesforce Support service-level agreements (SLAs).&lt;/p&gt;

&lt;p&gt;For this reason, the only way to create a pre-release scratch org is to sign up for a &lt;a href="https://sfdc.co/RR-Pre-Release"&gt;pre-release trial Dev Hub org&lt;/a&gt; (subject to availability).&lt;/p&gt;

&lt;p&gt;This article was originally published in &lt;a href="https://matheusgoncalves.com/how-to-select-the-salesforce-release-for-a-scratch-org/"&gt;matheus.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>sfdx</category>
      <category>release</category>
    </item>
    <item>
      <title>How to Query Salesforce Code Coverage</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Tue, 18 Sep 2018 02:13:32 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/how-to-query-salesforce-code-coverage-53bg</link>
      <guid>https://dev.to/matheusgoncalves/how-to-query-salesforce-code-coverage-53bg</guid>
      <description>&lt;p&gt;In Salesforce Orgs, code coverage percentage is a calculation of the number of covered lines divided by the sum of the number of covered lines and uncovered lines. &lt;/p&gt;

&lt;p&gt;In addition to ensuring the quality of your code, unit tests enable you to meet the code coverage requirements for deploying or packaging Apex. To deploy Apex or package it for the Salesforce AppExchange, unit tests must cover at least 75% of your Apex code, and those tests must pass.&lt;/p&gt;

&lt;p&gt;After running tests, you can view code coverage information in the Tests tab of the Developer Console. The code coverage pane includes coverage information for each Apex class and the overall coverage for all Apex code in your organization.&lt;/p&gt;

&lt;p&gt;However, you can also use SOQL queries with Tooling API as an alternative way of checking code coverage and a quick way to get more details. Let's see how it works:&lt;/p&gt;

&lt;h2&gt;Inspecting Code Coverage&lt;/h2&gt;

&lt;h3&gt;Step 1 - Get your org's base URL:&lt;/h3&gt;

&lt;p&gt;If you know what's your Org's base URL (&lt;em&gt;you can get it from your browser as well&lt;/em&gt;), please jump to step 2.&lt;/p&gt;

&lt;ul&gt;
   &lt;li&gt;From Developer Console, open the Debug menu, then select the option "Open Execute Anonymous Window (CTRL+E)
   &lt;/li&gt;
&lt;li&gt;Enter the following Apex Code:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    String baseURL =  'https://' + System.URL.getSalesforceBaseUrl().getHost();
    System.debug(baseURL);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
    &lt;li&gt;Click the button [Execute]&lt;/li&gt;

    &lt;li&gt;Go to your Logs tab on the bottom of the page&lt;/li&gt;

    &lt;li&gt;Copy the full Base URL, including &lt;em&gt;&lt;strong&gt;https://&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;Step 2 - Now you know your base URL, create a Remote Site Setting&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;From Setup, enter Remote Site Settings in the Quick Find box, then select Remote Site Settings.&lt;/li&gt;

    &lt;li&gt;Click New Remote Site.&lt;/li&gt;

    &lt;li&gt;Enter a descriptive term for the Remote Site Name.&lt;/li&gt;

    &lt;li&gt;Enter the URL for the remote site.&lt;/li&gt;

    &lt;li&gt;Optionally, enter a description of the site.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-10.13.45-AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-10.13.45-AM.png" alt="" width="704" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Click Save.&lt;/li&gt;

    &lt;li&gt;Just in case, create a second Remote Site Settings for the URL in the "Visual.force.com" format:
            &lt;ul&gt;&lt;li&gt;https://c.&lt;strong&gt;xx99&lt;/strong&gt;.visual.force.com - where xx99 is the code of your org's instance.&lt;/li&gt;&lt;/ul&gt;
        &lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;Step 3 - Get the JSON file for the Code Coverage Wrapper&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;Go back to the Developer Console, open the Debug menu, then select the option "Open Execute Anonymous Window (CTRL+E)&lt;/li&gt;
    &lt;li&gt;Enter the following Apex Code:&lt;/li&gt;

&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click the button [Execute]&lt;/li&gt;
&lt;li&gt;Go to your Logs tab on the bottom of the page&lt;/li&gt;
&lt;li&gt;Copy the full JSON result&lt;/li&gt;
  &lt;ul&gt;
&lt;li&gt;Please note you will need to remove any text before the first &lt;strong&gt;"{"&lt;/strong&gt; bracket. &lt;/li&gt;
      &lt;li&gt;Eg.: "&lt;em&gt;hh:mm:ss:999 USER_DEBUG [99]|DEBUG|&lt;/em&gt;"&lt;/li&gt;
  &lt;/ul&gt;
&lt;li&gt;Go to the website JSON2Apex: &lt;a href="https://json2apex.herokuapp.com/" rel="noopener noreferrer"&gt;https://json2apex.herokuapp.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Paste your JSON file&lt;/li&gt;
&lt;li&gt;Enter the name for the generated class (here, we will use &lt;strong&gt;CodeCoverageWrapper&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Click the button &lt;strong&gt;[Create Apex]&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-3.50.04-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-3.50.04-PM.png" alt="" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download the generated zip file that contains the Wrapper class plus the Test class.&lt;/li&gt;
&lt;li&gt;Extract the files&lt;/li&gt;
&lt;li&gt;Open the files with your prefered text editor&lt;/li&gt;
&lt;li&gt;Check if everything looks good, and add these classes to your Salesforce org as new classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how it looks like: &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;Step 4 - Create a Helper Class&lt;/h3&gt; 

&lt;ul&gt;
    &lt;li&gt;Create the following class, that contains a method that will query and return information about the Code Coverage&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Don't forget to write the test class for it. &lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;Step 5 - Create a Controller and a Page to display the Code Coverage&lt;/h3&gt;

&lt;ul&gt;&lt;li&gt;Create the following class, that contains the logic for the page&lt;/li&gt;&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Create the following page, using the controller we just created.&lt;/p&gt;

&lt;p&gt;Please note we're leveraging &lt;strong&gt;&lt;a href="https://www.lightningdesignsystem.com/getting-started/" rel="noopener noreferrer"&gt;Salesforce Lightning Design System&lt;/a&gt;&lt;/strong&gt;;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The page has two buttons. One to sort the results by Class / Trigger name, and another button to sort the results by Code Coverage.&lt;/p&gt;

&lt;p&gt;This is how it looks like: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-4.28.28-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-4.28.28-PM.png" alt="" width="795" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-4.30.06-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2018%2F09%2FScreen-Shot-2018-09-17-at-4.30.06-PM.png" alt="" width="796" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Final Considerations&lt;/h2&gt;

&lt;p&gt;You can follow the same logic to use the Tooling API whenever you need to query exposed metadata used in developer tooling that you can access through REST or SOAP. &lt;/p&gt;

&lt;p&gt;Also, the method &lt;em&gt;&lt;strong&gt;sortCodeCoverageMapByCoverage&lt;/strong&gt;&lt;/em&gt; from &lt;em&gt;&lt;strong&gt;CodeCoverageHelper&lt;/strong&gt;&lt;/em&gt; is quite handy and can be used as an example for situations when you need to sort Maps by its values. In this case, sort the Code Coverage percentage value. &lt;/p&gt;

&lt;p&gt;Just don't forget to adapt the Wrapper and the Comparable.&lt;/p&gt;

&lt;p&gt;You can find all code used for this project in my GitHub account, at &lt;a href="https://github.com/gitmatheus/QueryCodeCoverage" rel="noopener noreferrer"&gt;github.com/gitmatheus/QueryCodeCoverage&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gitmatheus" rel="noopener noreferrer"&gt;
        gitmatheus
      &lt;/a&gt; / &lt;a href="https://github.com/gitmatheus/QueryCodeCoverage" rel="noopener noreferrer"&gt;
        QueryCodeCoverage
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      How to Query Code Coverage - After running tests, you can view code coverage information in the Tests tab of the Developer Console. The code coverage pane includes coverage information for each Apex class and the overall coverage for all Apex code in your organization. However, you can also use SOQL queries with Tooling API as an alternative way of checking code coverage and a quick way to get more details.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;How to Query Code Coverage&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;In Salesforce Orgs, code coverage percentage is a calculation of the number of covered lines divided by the sum of the number of covered lines and uncovered lines.  In addition to ensuring the quality of your code, unit tests enable you to meet the code coverage requirements for deploying or packaging Apex.&lt;/p&gt;
&lt;p&gt;To deploy Apex or package it for the Salesforce AppExchange, unit tests must cover at least 75% of your Apex code, and those tests must pass.  After running tests, you can view code coverage information in the Tests tab of the Developer Console. The code coverage pane includes coverage information for each Apex class and the overall coverage for all Apex code in your organization.  However, you can also use SOQL queries with Tooling API as an alternative way of checking code coverage and a quick way to get more details.&lt;/p&gt;
&lt;p&gt;The code…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/gitmatheus/QueryCodeCoverage" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;I hope you enjoyed the ride and learned something new today. &lt;/p&gt;

&lt;p&gt;See you next time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally posted at &lt;a href="https://matheus.dev/how-to-query-salesforce-code-coverage/" rel="noopener noreferrer"&gt;matheus.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>codecoverage</category>
      <category>query</category>
      <category>lightning</category>
    </item>
    <item>
      <title>Time traveling, dreams and gratitude</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Thu, 31 May 2018 06:07:59 +0000</pubDate>
      <link>https://dev.to/toadgeek/time-traveling-dreams-and-gratitude-20i2</link>
      <guid>https://dev.to/toadgeek/time-traveling-dreams-and-gratitude-20i2</guid>
      <description>&lt;p&gt;I just found a picture of my house in mid-2001. Look at this mess!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fm0z0blmftspan51j91zi.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fm0z0blmftspan51j91zi.jpeg" alt="An old house, computers to fix and software to code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A back house, suburbs of São Paulo, Brazil. One bedroom, a kitchen and an outdoor bathroom. &lt;/p&gt;

&lt;p&gt;That was... it. &lt;/p&gt;

&lt;p&gt;And I was making money with tech support, fixing computers and programming video rental systems in Clipper. Something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbrt8hf9ey1r4masxml43.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbrt8hf9ey1r4masxml43.gif" alt="A very elaborated interface programmed in Clipper"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a lot of fun. Seriously. But I could never imagine that in 2018 I would be working with Salesforce for one of the best technology companies in the world, and living in Seattle. Not in my best dreams. &lt;/p&gt;

&lt;p&gt;All I knew at that time was that I was living by myself, trying really hard to make a living. &lt;/p&gt;

&lt;p&gt;I was 19 years old, and I needed to continue studying and working, learning, and trying to be a better person and professional every day. That was my plan.&lt;/p&gt;

&lt;p&gt;I think it's important to look back and see where I came from, and remember everything I went through, to give even more value to what I have today, to have gratitude for all this and for everyone who helped me. ❤️&lt;/p&gt;

&lt;p&gt;So: If you think your dream is an unreachable thing, impossible, maybe you're already living part of it and you don't even know it.&lt;/p&gt;

&lt;p&gt;Keep Fighting! 🤜🤛&lt;/p&gt;

</description>
      <category>life</category>
      <category>timetraveling</category>
      <category>dreams</category>
      <category>gratitude</category>
    </item>
    <item>
      <title>Unit Test: Can we mock relationships in Salesforce Apex?</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Tue, 24 Apr 2018 04:38:12 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/unit-test-can-we-mock-relationships-in-salesforce-apex-4ohb</link>
      <guid>https://dev.to/matheusgoncalves/unit-test-can-we-mock-relationships-in-salesforce-apex-4ohb</guid>
      <description>&lt;p&gt;I've been trying to use some of my spare time to help my fellow Salesforce Developers in our community. And one of the best places to do so, is &lt;a href="https://salesforce.stackexchange.com" rel="noopener"&gt;Salesforce Stack Exchange&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;And a few days ago someone posted the &lt;a href="https://salesforce.stackexchange.com/questions/215326/can-we-mock-relationships-in-apex/" rel="noopener"&gt;following question&lt;/a&gt;: &lt;/p&gt;

&lt;blockquote&gt;&lt;em&gt;How can I write a test method without actually doing the query (to speed up test run times)? As far as I know, the only way to return relationships more than one level deep is to query for them. I know ApexMock has IDGenerator but cannot see how I can use it for this use case?&lt;/em&gt;&lt;/blockquote&gt;

&lt;p&gt;Well, can we mock relationships in Apex to improve a test's performance?&lt;/p&gt;

&lt;p&gt;And the answer is &lt;strong&gt;yes, it's possible&lt;/strong&gt;. I'm going to explain how to achieve that in incremental steps, to try to simplify the concept. &lt;/p&gt;

&lt;p&gt;You can mock virtually any relationship if you use a Mock Data Layer Pattern.&lt;/p&gt;

&lt;p&gt;Imagining the scenario presented by the developer &lt;a href="https://salesforce.stackexchange.com/questions/215326/can-we-mock-relationships-in-apex/" rel="noopener"&gt;in that question&lt;/a&gt;, you could add an Interface to your main class. Let's call it IDataLayer. Add this new interface to the main class (here, called &lt;strong&gt;DataLayerHandler.cls&lt;/strong&gt;)&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now, in the same class, let's create an inner class for this data layer, implementing the Interface you just created:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Ok, now how to access it? We need to create an instance of this DataLayer, and we will use the DataLayerHandler Class constructor for that. This is really important, I'll explain it below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;But why to do all of that?! And this is the magic: because now you can pass a MOCK version of the data layer to you class to use!! Given this handler class, let's create a test class and a mock class, implementing the same interface:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;With the mock version of the data layer, you can start creating your mock records. Use the method &lt;em&gt;&lt;strong&gt;getFakeId(Schema.SObjectType type)&lt;/strong&gt;&lt;/em&gt; to create Ids to your mock records:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;There you go. This way you can mock several different types of relationships.&lt;/p&gt;

&lt;p&gt;This is an extremely useful pattern and allow you to test your logic in different scenarios without running queries, without hitting the database. It's a good way to improve your tests performance.&lt;/p&gt;

&lt;p&gt;Just don't forget to create some bulkified tests as well.&lt;/p&gt;

&lt;p&gt;I hope that helps!&lt;/p&gt;

</description>
      <category>apex</category>
      <category>salesforce</category>
      <category>dev</category>
      <category>testing</category>
    </item>
    <item>
      <title>Salesforce DX: Useful CLI Commands</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Tue, 03 Oct 2017 13:13:21 +0000</pubDate>
      <link>https://dev.to/toadgeek/salesforce-dx-useful-cli-commands-52k</link>
      <guid>https://dev.to/toadgeek/salesforce-dx-useful-cli-commands-52k</guid>
      <description>&lt;p&gt;Salesforce DX is finally available and it is amazing! Now professional developers can build collaboratively with continuous delivery using &lt;a href="https://developer.salesforce.com/platform/dx" rel="noopener noreferrer"&gt;Salesforce DX&lt;/a&gt;, the open and integrated experience that makes development on the Salesforce Platform easy.&lt;/p&gt;

&lt;p&gt;I strongly recommend you to watch this presentation, made by &lt;a href="https://twitter.com/wadewegner" rel="noopener noreferrer"&gt;Wade Wegner&lt;/a&gt;, with an introduction to Salesforce DX, talking about principles of Modern Software Delivery, how DX will improve the Developer Experience, some patterns and anti-patterns and how to adopt Salesforce DX:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/exZ3TICOzd8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Well, once you decide to switch, you'll notice that you can use the &lt;a href="https://developer.salesforce.com/tools/sfdxcli" rel="noopener noreferrer"&gt;Salesforce command-line interface (CLI)&lt;/a&gt; for most Salesforce DX tasks. These tasks include authorizing a Dev Hub org, creating a scratch org, synchronizing source code between your scratch orgs and VCS, and running tests.&lt;br&gt;
You can start using the CLI right after you install it.&lt;/p&gt;

&lt;p&gt;The CLI commands are grouped into top-level topics. For example, the force top-level topic is divided into topics that group commands by functionality, such as the force:org commands to manage your orgs.&lt;/p&gt;

&lt;p&gt;Run ---help at each level to get more information.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx --help                   // lists all top-level topics&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sfdx force --help             // lists all the topics under force&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sfdx force:org --help         // lists all the commands in the topic force:org&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sfdx force:org:open --help    // detailed info about the force:org:open command&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Imagine you want to login to your Hub Org:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:auth:web:login --setalias my-hub-org --instanceurl &lt;a href="https://login.salesforce.com" rel="noopener noreferrer"&gt;https://login.salesforce.com&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Imagine now that you want to login to your sandbox:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:auth:web:login --setalias my-sandbox --instanceurl &lt;a href="https://test.salesforce.com" rel="noopener noreferrer"&gt;https://test.salesforce.com&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Maybe you want to get a list to all orgs you're connected to: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:org:list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F08%2FScreen-Shot-2017-08-30-at-12.30.40-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F08%2FScreen-Shot-2017-08-30-at-12.30.40-PM.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To open one of these orgs:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:org:open -u my-sandbox&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To mark a scratch org for deletion: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:org:delete -u my-sandbox&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;To &lt;strong&gt;remove an old hub org&lt;/strong&gt;, or non-scratch org from Salesforce DX org list, you need to manually cleanup the DX configs in the local installation. It would be nice for this to be something in the actual CLI commands: the ability to clean up old orgs that are no longer needed. For the time being, use the following steps:&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;Mac OS and Linux&lt;/strong&gt;, you can find your DX config folder, called .sfdx, in your user home directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd ~/.sfdx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;Windows&lt;/strong&gt;, you can use &lt;/p&gt;

&lt;p&gt;&lt;code&gt;%USERPROFILE%.sfdx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In that folder there are a host of .json files, named for the username of the admin user you registered for that org. In my case, in this instance it was called &lt;a href="mailto:mgoncalves@dx.pilot"&gt;mgoncalves@dx.pilot&lt;/a&gt;, so sure enough, there it was:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;a href="mailto:mgoncalves@dx.pilot.json"&gt;mgoncalves@dx.pilot.json&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Inside the file, or the hashes for current access token, refresh token, and all the other OAuth goodness that allows DX to access your org. So I simply deleted that file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;gt; rm &lt;a href="mailto:mgoncalves@dx.pilot.json"&gt;mgoncalves@dx.pilot.json&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That appears to have &lt;strong&gt;cleaned it all up&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;To retrieve unpackaged Source Defined in a package.xml file (eg.: the file created by &lt;a href="http://mavensmate.com/" rel="noopener noreferrer"&gt;MavensMate&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:mdapi:retrieve -r ./mdapipkg -u [your_username] -k ./package.xml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To retrieve an &lt;a href="https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_retrieve_unman_pack.htm" rel="noopener noreferrer"&gt;unmanaged package you want to convert to Salesforce DX&lt;/a&gt;: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:mdapi:retrieve -s -r ./mdapipkg -u [your_username] -p &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To convert the retrieved source Defined in a package.xml file: the first step is to unzip &lt;strong&gt;unpackaged.zip&lt;/strong&gt; using a zip file management utility or from the command line. For example, on a Mac, double-click unpackaged.zip in Finder or type the following command on the command line:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;unzip ./mdapipkg/unpackaged.zip -d ./mdapipkg/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then convert the source code to the Salesforce DX project structure:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:mdapi:convert -r ./mdapipkg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To create a scratch org, first &lt;a href="https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm" rel="noopener noreferrer"&gt;create a JSON file&lt;/a&gt; with the or configuration. Then:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:org:create -f project-scratch-def.json -a MyScratchOrg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To push changes, use a &lt;strong&gt;Force Push&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F08%2Fforce-push-yoda.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F08%2Fforce-push-yoda.gif" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I mean, use this: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:source:push -u MyScratchOrg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To push changes ignoring errors (&lt;em&gt;with great powers, great responsibilities. Be careful&lt;/em&gt;): &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:source:push -u MyScratchOrg --ignorewarnings --forceoverwrite&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Salesforce DX CLI is a powerful command line interface, a tool that simplifies development and build automation when working with your Salesforce org.&lt;/p&gt;

&lt;p&gt;For even more information, run this command to view all available commands in the force topic.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sfdx force:doc:commands:list&lt;/code&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;See you next time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally posted at &lt;a href="http://matheusgoncalves.com/salesforce-dx-useful-cli-commands/" rel="noopener noreferrer"&gt;matheusgoncalves.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>salesforcedx</category>
      <category>trailhead</category>
      <category>apex</category>
    </item>
    <item>
      <title>How I ended up becoming a Salesforce Developer</title>
      <dc:creator>Matheus Goncalves</dc:creator>
      <pubDate>Mon, 02 Oct 2017 18:42:11 +0000</pubDate>
      <link>https://dev.to/matheusgoncalves/how-i-ended-up-becoming-a-salesforce-developer-1m6</link>
      <guid>https://dev.to/matheusgoncalves/how-i-ended-up-becoming-a-salesforce-developer-1m6</guid>
      <description>&lt;p&gt;When I look back now, working with software development has been like a rollercoaster. &lt;/p&gt;

&lt;p&gt;Everything started when I was only 13 years old, with a language called Clipper. Yes, I know. It's been a while. I remember when my dad was installing this old computer in our modest living room. It was love at first sight, and it was a lot of fun. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2Fca-clipper.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2Fca-clipper.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the first time in my life the word "&lt;em&gt;creativity&lt;/em&gt;" had an empirical meaning. I was creating things. Digital things, but still, things. Pieces of code doing exactly what I told them to do. That was fascinating.&lt;/p&gt;

&lt;p&gt;After that I've been exploring this world a lot. Sudoku games with C++ or Visual Basic, complete systems with Oracle Forms 4, PL/SQL, SQL Server, Pascal/Delphi and, ultimately, becoming a Java and C# developer, trying as much as possible to become fluent on both languages. &lt;/p&gt;

&lt;p&gt;We must constantly endeavor if we are to succeed, right? So I did. And, for years, that was my whole universe.&lt;/p&gt;

&lt;p&gt;One day I had to integrate an old B2B Marketing application, built with Java (Struts 1.0) with a new platform. It was a CRM and it was on the clouds. Oh, the clouds, they're so magical, aren't they? &lt;/p&gt;

&lt;p&gt;But this was my first contact with Salesforce Development. Let's say I remember the clouds because I had to learn how to build an airplane while flying. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2Fairplane-2-25zk8ct.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2Fairplane-2-25zk8ct.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After changing pretty much the whole project and adjusting the requirements, I started to learn how to develop custom interfaces, objects, records, Visualforce Components, Visualforce pages, Apex Statements, classes and everything I needed to accomplish my tasks. &lt;/p&gt;

&lt;p&gt;In order to do so, I needed help, of course. So I started exploring the Salesforce Stack Exchange, one of the most important and helpful communities of Salesforce Developers.&lt;/p&gt;

&lt;p&gt;There I learned about Salesforce triggers, some of the platform limitations, some basic SOQL statements (something equivalent to SQL, remember), and even ways to change the solution by changing the approach within the Salesforce possibilities. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2FScreen-Shot-2017-01-10-at-1.18.59-AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2FScreen-Shot-2017-01-10-at-1.18.59-AM.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In 2014 I attended &lt;a href="https://www.salesforce.com/dreamforce" rel="noopener noreferrer"&gt;Dreamforce&lt;/a&gt; in San Francisco. It's the must-attend tech conference of the year for anyone who's in the Salesforce Ecosystem. And that was a milestone for me. &lt;/p&gt;

&lt;p&gt;Not only because of the free books I could get there (&lt;em&gt;Force.com Fundamentals, Mobile SDK Developer Guide, Salesforce1 Mobile Mobile App Developer Guide and Heroku Programming&lt;/em&gt;), but also because I was in touch with the brightest minds and ideas of Salesforce universe and because it was the first time I heard about &lt;strong&gt;&lt;a href="https://trailhead.salesforce.com/users/profiles/00550000006FdAIAA0" rel="noopener noreferrer"&gt;Trailhead&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;If, for some reason, you don't know what &lt;a href="https://trailhead.salesforce.com/en" rel="noopener noreferrer"&gt;Salesforce Trailhead&lt;/a&gt; is, imagine a way to learn more and more about how to solve problems, how to use the best practices, how to become a better developer, by taking challenging and fulfilling tasks that you can accomplish in your pace, that makes you satisfied and happy because you actually feel you are fully developing your abilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2FScreen-Shot-2017-01-10-at-1.29.37-AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fmatheusgoncalves.com%2Fwp-content%2Fuploads%2F2017%2F01%2FScreen-Shot-2017-01-10-at-1.29.37-AM.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/zr4k49PzCBQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;So by getting in touch with the most amazing and welcoming developers community there is, by learning how Salesforce lives the &lt;a href="https://trailhead.salesforce.com/en/module/manage_the_sfdc_way_ohana" rel="noopener noreferrer"&gt;Ohana&lt;/a&gt; values every day and by learning more and more about the platform, I became a Salesforce Developer. And, in 2016, I got my &lt;a href="http://certification.salesforce.com/verification-email?init=1&amp;amp;email=mattgobr@gmail.com" rel="noopener noreferrer"&gt;Salesforce Platform Developer Certification&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have a strong thirst for knowledge, therefore I'm aware there's so much more to learn, more badges the earn and more problems to solve. This is just the beginning. And you're more than welcome to join us.&lt;/p&gt;

&lt;p&gt;Take a deeper dive into these values and don't forget to check the &lt;em&gt;&lt;a href="https://developer.salesforce.com/developer-career-ebook" rel="noopener noreferrer"&gt;Salesforce Developer Career eBook&lt;/a&gt;&lt;/em&gt;. You may leave with some ideas you can take to your company, or begin to implement yourself. &lt;/p&gt;

&lt;p&gt;Spoiler alert: walking this path may change your life ðŸ˜‰ &lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was originally posted at &lt;a href="http://matheusgoncalves.com/ended-becoming-salesforce-developer/" rel="noopener noreferrer"&gt;matheusgoncalves.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
