{"id":7183,"date":"2020-12-06T20:05:08","date_gmt":"2020-12-07T01:05:08","guid":{"rendered":"https:\/\/www.jitendrazaa.com\/blog\/?p=7183"},"modified":"2020-12-07T12:23:30","modified_gmt":"2020-12-07T17:23:30","slug":"breaking-5-myths-scratch-orgs-salesforce-dx","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/breaking-5-myths-scratch-orgs-salesforce-dx\/","title":{"rendered":"Breaking 5 Myths &#8211; Scratch Orgs &#038; Salesforce DX"},"content":{"rendered":"\n<p class=\"justify\">Its been around 3 years that Salesforce has released new tooling set for developers &#8211; Salesforce DX. I&#8217;ve been working on Salesforce since days of S-Control around 2008 and have seen extreme changes on platform for better.<\/p>\n\n\n\n<p class=\"justify\">To be honest, it&#8217;s tough to keep yourself up to date on latest changes that Salesforce has been doing , however there are resources like <a href=\"https:\/\/medium.com\/salesforce-architects\">Medium<\/a>, <a href=\"https:\/\/trailhead.salesforce.com\/\">Trailhead<\/a> and many other blogs to help you get up to speed.<\/p>\n\n\n\n<p class=\"justify\">I&#8217;ve seen days and written code on <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/force-com-ide\/\">Force.com IDE<\/a>, Developer Console, many web based IDE and definitely my heart and love at the moment is with VSCode more importantly Scratch Org &amp; unlocked packages.<\/p>\n\n\n\n<p class=\"justify\">Purpose of this blog post is to bust some of myths around using Scratch Org in Salesforce DX however before I start, lets agree on below aspects of project development &amp; management<\/p>\n\n\n\n<ol class=\"justify wp-block-list\"><li>Most of projects in Salesforce follows <a href=\"https:\/\/www.scaledagileframework.com\/devops\/\">Agile<\/a> and one of most important aspect of Agile is <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/devops\/\">Devops<\/a>. Your team should spend enough time &amp; energy in planning <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/devops\/\">Devops<\/a> strategy like branch structure, tools, processes etc. In my experience , <a href=\"https:\/\/www.jitendrazaa.com\/blog\/tag\/devops\/\">Devops<\/a> is more about process rather than tool.<\/li><li>On basis of above point, Source of truth for code &amp; configuration should be your <a href=\"https:\/\/en.wikipedia.org\/wiki\/Version_control\">Source Code Management<\/a> , which in most of cases is Git.<\/li><\/ol>\n\n\n\n<p class=\"justify\">What if your project is not following above 2 principles ? Well, you might already able to relate some of problems like why code is overwritten , no track of which class or fields created by who and why ? Your team spending most of time fixing deployment issue instead of working on actual implementation.  <\/p>\n\n\n\n<p class=\"justify\">Lets not spend more time and directly jump on some of myths about using scratch org<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Myth 1 &#8211; Scratch Org is only for packaging &amp; ISV partners<\/h3>\n\n\n\n<p class=\"justify\">Scratch Org can be used for quick POC or actual implementations. I&#8217;ve been using scratch org for each user story which normally takes 1-3 weeks of implementation. Every time, scratch org created, I get liberty to choose which Git branch would be source of truth. <a href=\"https:\/\/help.salesforce.com\/articleView?id=data_sandbox_clone.htm&amp;type=5\">Can you refresh dev pro sandbox from Full copy or use 10 days old code that was in production ?<\/a> There are many other considerations while creating sandbox, you don&#8217;t have much control on which metadata would be carried over as starting point.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\">Myth 2 &#8211; No easy way to get metadata from Sandbox to Scratch Org<\/h3>\n\n\n\n<p class=\"justify\">Ask your self, when was last time you refreshed Sandbox ? Months, May be year ? Then ask another question &#8211; Why you are not refreshing your sandbox ? Most probably answer would be , we don&#8217;t know what will break or what are post refresh steps. Or original team is not in project and you are not comfortable refreshing sandbox. <\/p>\n\n\n\n<p class=\"justify\">Problem is not getting metadata from Sandbox to Scratch Org, <strong>real problem is what&#8217;s source of truth for your metadata<\/strong> ? If you have SCM as source of truth then its just one command to get metadata in scratch org. In fact you can go any point in time in past to see how code was working to debug some issue in production which is huge advantage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Myth 3 &#8211; Sandbox &amp; Scratch Org cannot be used together <\/h3>\n\n\n\n<p class=\"justify\">There are multiple way you can use Scratch Org. Example &#8211; Each developer using it for stories assigned to them, once story moved to testing , dispose scratch org and create new. If you are using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mob_programming\">mob<\/a> or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pair_programming\">pair<\/a> programming , multiple developer can have access scratch org at the same time. <\/p>\n\n\n\n<p class=\"justify\">How many times you or your team missed components while deploying code ? Out of 20+ components, its easy to miss few. In scratch Org, <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/getting-started-with-salesforce-dx-salesforce-developer-experience\/\">push &amp; pull commands are life saver<\/a>. It will auto track changes for you. If your code not working as expected or POC got pushed to next year, start again from SCRATCH &amp; don&#8217;t worry about dormant code, metadata in your sandbox.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Myth 4 &#8211; As Scratch Org expires in 30 days, its no use for long running projects<\/h3>\n\n\n\n<p class=\"justify\">First, as per best practice, project should be modularized in small reusable components instead of monolithic code. Any requirement can be easily broken to small modules that can be implemented in 2-3 weeks. If developers are struggling with writing modular code, I would suggest <a href=\"https:\/\/www.jitendrazaa.com\/blog\/apex-design-patterns\/\">going through some of design patterns mentioned in my book and see how reusable, maintainable and performant code could be written in Salesforce.<\/a><\/p>\n\n\n\n<p class=\"justify\">Second, even if you are working on monolithic code, if source of truth is SCM then you can create scratch org anytime with draft \/ intermediate code stored on branch.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Myth 5 &#8211; Every developer would need access to Devhub if they want to create scratch Org<\/h3>\n\n\n\n<p>True, but you don&#8217;t need to pay for license and no need to worry about data security in production.<\/p>\n\n\n\n<p>Salesforce provides <strong><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.packagingGuide.meta\/packagingGuide\/dev_hub_license.htm\">free limited access license<\/a><\/strong> that can be assigned to all developers who need to create scratch org.<\/p>\n\n\n\n<p class=\"justify\">As you have reached towards end of this post, first 5 comments will get free <a href=\"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/mastering-visual-studio-and-salesforce-dx\/\">access to Udemy course about what is Salesforce DX &amp; how to use<\/a> it effectively. Also, let me know if there is something else stopping you from using scratch org in your project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Its been around 3 years that Salesforce has released new tooling set for developers &#8211; Salesforce DX. I&#8217;ve been working on Salesforce since days of S-Control around 2008 and have seen extreme changes on platform for better. To be honest, it&#8217;s tough to keep yourself up to date on latest changes that Salesforce has been [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7186,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[344,510,414,480,415],"class_list":["post-7183","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-architect","tag-cta","tag-salesforce-dx","tag-scratch-org","tag-sfdx"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/12\/Breaking-5-Myths-Scratch-Orgs-e1624579030977.jpg?fit=700%2C495&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":6951,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/mastering-visual-studio-and-salesforce-dx\/","url_meta":{"origin":7183,"position":0},"title":"Mastering Visual Studio and Salesforce DX","author":"Jitendra","date":"January 14, 2020","format":false,"excerpt":"3.5 hours of video to become Master on using and navigating Visual Studio, Need of scratch org and building modular application using Unlocked Packages","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce DX on Udemy","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2020\/01\/Salesforce-DX-on-Udemy.png?fit=1200%2C693&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6353,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/use-metadata-api-with-salesforce-dx\/","url_meta":{"origin":7183,"position":1},"title":"Use Metadata API with Salesforce DX","author":"Jitendra","date":"November 12, 2017","format":false,"excerpt":"How to use SalesforceDX to deploy metadata in Sandboxes or Non-Scratch Salesforce instances","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Use Metadata API or Package.xml with Salesforce DX","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Use-Metadata-API-or-Package.xml-with-SFDX.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6062,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/getting-started-with-salesforce-dx-salesforce-developer-experience\/","url_meta":{"origin":7183,"position":2},"title":"Most Frequently used SFDX Commands","author":"Jitendra","date":"May 25, 2017","format":false,"excerpt":"Introduction and basics of Salesforce Developer Experience (Salesforce DX) with source code and Video tutorials","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce Developer Experience - SFDX","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/05\/sfdx.jpg-large.jpg?fit=1024%2C512&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/05\/sfdx.jpg-large.jpg?fit=1024%2C512&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/05\/sfdx.jpg-large.jpg?fit=1024%2C512&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/05\/sfdx.jpg-large.jpg?fit=1024%2C512&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":6360,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/import-and-export-records-using-salesforce-dx\/","url_meta":{"origin":7183,"position":3},"title":"Import and Export Records using Salesforce DX","author":"Jitendra","date":"November 13, 2017","format":false,"excerpt":"Using Salesforce DX to Export and Import records into regular Salesforce Instances without dependency on developer hub org","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Import and Export Records using SalesforceDx","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Import-and-Export-Records-using-SalesforceDx.png?fit=1167%2C347&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Import-and-Export-Records-using-SalesforceDx.png?fit=1167%2C347&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Import-and-Export-Records-using-SalesforceDx.png?fit=1167%2C347&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Import-and-Export-Records-using-SalesforceDx.png?fit=1167%2C347&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/11\/Import-and-Export-Records-using-SalesforceDx.png?fit=1167%2C347&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6930,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/install-manage-package-in-scratch-org-using-salesforce-dx\/","url_meta":{"origin":7183,"position":4},"title":"Install Manage Package in Scratch Org using Salesforce DX","author":"Jitendra","date":"December 27, 2019","format":false,"excerpt":"Install CPQ, Field Service Lightning, B2B Commerce cloud in Scratch Org using SFDX Command","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Install Manage Package using SFDX in Scratch Org","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2019\/12\/Install-Manage-Package-using-SFDX-in-Scratch-Org.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2019\/12\/Install-Manage-Package-using-SFDX-in-Scratch-Org.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2019\/12\/Install-Manage-Package-using-SFDX-in-Scratch-Org.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2019\/12\/Install-Manage-Package-using-SFDX-in-Scratch-Org.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2019\/12\/Install-Manage-Package-using-SFDX-in-Scratch-Org.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6499,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/using-salesforcedx-sfdx-with-non-scratch-orgs\/","url_meta":{"origin":7183,"position":5},"title":"Using SalesforceDX (SFDX) with non Scratch Orgs","author":"Jitendra","date":"June 24, 2018","format":false,"excerpt":"How to use SalesforceDX (SFDX) with Sandbox, Developer and Production Orgs","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Use SFDX with non scratch Orgs","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-24-at-9.08.53-PM.png?fit=1200%2C645&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-24-at-9.08.53-PM.png?fit=1200%2C645&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-24-at-9.08.53-PM.png?fit=1200%2C645&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-24-at-9.08.53-PM.png?fit=1200%2C645&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-24-at-9.08.53-PM.png?fit=1200%2C645&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=7183"}],"version-history":[{"count":6,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7183\/revisions"}],"predecessor-version":[{"id":7190,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/7183\/revisions\/7190"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media\/7186"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=7183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=7183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=7183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}