{"id":1176,"date":"2026-09-01T11:00:00","date_gmt":"2026-09-01T05:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/"},"modified":"2026-09-01T11:00:00","modified_gmt":"2026-09-01T05:30:00","slug":"declarative-vs-programmatic-salesforce","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/","title":{"rendered":"Declarative vs Programmatic in Salesforce: When to Write Code"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Declarative vs Programmatic is the first big choice every Salesforce developer makes on every task. Should you build it with clicks, or should you write code? Picking the wrong side costs time, money and future pain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our last post, <a href=\"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-development\/\">What is Salesforce Development?<\/a>, you saw what developers build. Now we will learn how to decide between clicks and code. You will also get a simple checklist you can use at work tomorrow. If you want a refresher on clicks first, read our <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-flow-builder-automation-guide\/\">Flow Builder guide<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Does Declarative vs Programmatic Mean?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Declarative means you build features with point-and-click tools. You describe what you want in Setup, and Salesforce does the work. Programmatic means you write code, such as Apex or JavaScript, to tell Salesforce exactly how to do it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an easy way to picture it. Ordering a meal from a menu is declarative, because you pick from ready options. Cooking the meal yourself is programmatic, because you control every step and every ingredient.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why the Declarative vs Programmatic Choice Matters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Your team must maintain every feature for years. So the declarative vs programmatic choice affects much more than today&#8217;s task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clicks are faster to build and easier for admins to change. However, they can become slow or messy when the logic gets complex. Code is flexible and fast at scale, but it needs a developer to change it. It also needs test classes before it can reach production.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A good choice keeps the org simple. A bad choice, on the other hand, creates a tangle that nobody wants to touch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declarative Tools in Salesforce<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Salesforce gives you many strong click tools. Most of them come from the Admin series, so you may know them already.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flow Builder<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Flow is the main automation tool today. It can create and update records, send emails, show screens and call Apex. Salesforce has also retired Workflow Rules and Process Builder in favour of Flow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Validation Rules and Formulas<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Validation rules stop bad data from saving. Formula fields calculate values on the fly. Both use a simple formula language, not a programming language.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Page Layouts and Lightning App Builder<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">These tools control what users see on screen. You can add components, set visibility rules and build whole apps without code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reports, Dashboards and Approvals<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Reports show data in tables and charts. Approval processes route records to managers for sign-off. Again, they need no code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Programmatic Tools in Salesforce<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When clicks are not enough, developers reach for code. These are the main programmatic tools.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apex<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apex runs on Salesforce servers. You use it for triggers, complex logic, batch jobs and integrations with other systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Lightning Web Components<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">LWC lets you build custom screens with HTML, JavaScript and CSS. You use it when a standard page cannot show what the user needs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">APIs and Integrations<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Salesforce offers REST, SOAP and Bulk APIs. Developers use them to connect Salesforce with outside apps, such as a payment gateway.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declarative vs Programmatic: Side by Side<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The table below compares both approaches across the points that matter most in real projects.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Declarative (clicks)<\/th><th>Programmatic (code)<\/th><\/tr><\/thead><tbody><tr><td>Who builds it<\/td><td>Admins and developers<\/td><td>Developers<\/td><\/tr><tr><td>Build speed<\/td><td>Fast for simple logic<\/td><td>Slower to start<\/td><\/tr><tr><td>Complex logic<\/td><td>Gets hard to read<\/td><td>Handles it well<\/td><\/tr><tr><td>Large data volumes<\/td><td>Can hit limits sooner<\/td><td>Better control with bulk code<\/td><\/tr><tr><td>Testing<\/td><td>Manual testing, flow tests<\/td><td>Apex test classes required<\/td><\/tr><tr><td>Who can change it<\/td><td>Most admins<\/td><td>Only developers<\/td><\/tr><tr><td>Custom user interface<\/td><td>Limited to standard parts<\/td><td>Fully custom with LWC<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When to use which comes down to one rule. Start with clicks, and switch to code only when clicks cannot meet the need cleanly.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-1024x640.png\" alt=\"Declarative vs Programmatic diagram comparing clicks and code side by side\" class=\"wp-image-1174\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Declarative vs Programmatic tools compared side by side.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to Make the Declarative vs Programmatic Decision<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can use a short set of questions for every new requirement. Ask them in order, and stop as soon as you get a clear answer.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Can a standard feature do it already? If yes, use it and stop.<\/li>\n\n<li>Can a formula, validation rule or Flow do it simply? If yes, use clicks.<\/li>\n\n<li>Will the logic need many decisions, loops or nested conditions? If yes, lean towards code.<\/li>\n\n<li>Will it process thousands of records at once? If yes, Apex is usually safer.<\/li>\n\n<li>Does it need a custom screen or an outside system? If yes, use LWC or Apex.<\/li>\n\n<li>Who will maintain it later? If only admins will, try hard to stay with clicks.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-1024x640.png\" alt=\"Declarative vs Programmatic checklist diagram with six questions for choosing clicks or code\" class=\"wp-image-1175\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">A six-question checklist for every declarative vs programmatic decision.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This checklist is not a strict law. Still, it gives your team a shared language for each declarative vs programmatic decision.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Real Declarative vs Programmatic Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s solve the same problem both ways at Bright Path Tutors, so you can see declarative vs programmatic in action. The requirement is simple. When a user marks a Course as online, set its Duration_in_Weeks__c to 6 if it is empty.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Declarative Way<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An admin can build this with a record-triggered flow in a few minutes.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to Setup &gt; Process Automation &gt; Flows &gt; New Flow.<\/li>\n\n<li>Choose Record-Triggered Flow, then select the Course object.<\/li>\n\n<li>Set it to run when a user creates or updates a record.<\/li>\n\n<li>Add an entry condition: Is_Online__c equals True and Duration_in_Weeks__c is null.<\/li>\n\n<li>Choose &#8220;Fast Field Updates&#8221;, then add an Assignment that sets Duration_in_Weeks__c to 6.<\/li>\n\n<li>Save the flow as &#8220;Course Default Duration&#8221; and activate it.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For this simple rule, the flow is the right choice. It is quick, clear and any admin can change it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Programmatic Way<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A developer could write the same logic as a trigger.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>trigger CourseDuration on Course__c (before insert, before update) {\n    for (Course__c c : Trigger.new) {\n        \/\/ Only online courses with no duration\n        if (c.Is_Online__c &amp;&amp; c.Duration_in_Weeks__c == null) {\n            c.Duration_in_Weeks__c = 6;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The trigger runs before the record saves. It checks two conditions and sets the duration. It works, but it also needs a test class and a deployment. So for this case, code is extra effort with no real gain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">When Code Wins<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now imagine a harder rule. The duration must come from an outside timetable system, based on the trainer&#8217;s calendar. Flow can call outside systems in some cases, but this needs retries, error logs and data mapping. Here, an Apex class with a callout is the cleaner choice.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class CourseTimetable {\n    \/\/ Gets the duration from an outside timetable service\n    public static Integer getWeeks(String courseCode) {\n        HttpRequest req = new HttpRequest();\n        req.setEndpoint('callout:Timetable_API\/courses\/' + courseCode);\n        req.setMethod('GET');\n        HttpResponse res = new Http().send(req);\n        Map&lt;String, Object&gt; body =\n            (Map&lt;String, Object&gt;) JSON.deserializeUntyped(res.getBody());\n        return (Integer) body.get('weeks');\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This class sends a GET request through a Named Credential called Timetable_API. Then it reads the JSON reply and returns the number of weeks. We will cover callouts fully in the integration part of this series.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declarative vs Programmatic Examples for Common Needs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Real requirements make the rule easier to understand. The table below lists common requests from Bright Path Tutors and the best tool for each.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Requirement<\/th><th>Best choice<\/th><th>Why<\/th><\/tr><\/thead><tbody><tr><td>Fee must be above 500<\/td><td>Validation rule<\/td><td>One simple condition<\/td><\/tr><tr><td>Show total fees of a student<\/td><td>Roll-up summary field<\/td><td>Built-in, no logic needed<\/td><\/tr><tr><td>Email the trainer when a course starts<\/td><td>Scheduled flow<\/td><td>Simple time-based action<\/td><\/tr><tr><td>Split a fee across 3 installments<\/td><td>Flow or Apex<\/td><td>Depends on how complex the rules are<\/td><\/tr><tr><td>Sync courses with an outside LMS<\/td><td>Apex callout<\/td><td>Needs retries and error handling<\/td><\/tr><tr><td>Drag-and-drop timetable screen<\/td><td>Lightning Web Component<\/td><td>Fully custom user interface<\/td><\/tr><tr><td>Recalculate 50,000 records each night<\/td><td>Batch Apex<\/td><td>Large data volume<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Look at the pattern in this table. The simple, single-step rules go to clicks. Rules with heavy data, outside systems or custom screens go to code. That pattern is the heart of every declarative vs programmatic decision.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declarative vs Programmatic and Governor Limits<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Salesforce runs many companies on shared servers. So it sets limits on how much work one transaction can do. For example, one transaction can run up to 100 SOQL queries in synchronous Apex.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These limits apply to both clicks and code. A flow that gets records inside a loop can hit the same limit as bad Apex. However, code gives you finer control. You can collect records in a list, query once and update once.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means the declarative vs programmatic question is also a performance question. If a flow keeps hitting limits during testing, it may be time to move that part to Apex.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mixing Both Sides of Declarative vs Programmatic<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The best orgs do not pick one side forever. Instead, they mix both. A flow can call an Apex action when it needs heavy logic. An LWC can sit inside a screen flow to give users a better form.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This mix gives you the best of both worlds. Admins keep control of the simple parts, and developers handle the hard parts. So the declarative vs programmatic question is often &#8220;which part goes where&#8221;, not &#8220;one or the other&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Declarative vs Programmatic Choices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Writing code for simple rules. A validation rule is faster to build and easier to change.<\/li>\n\n<li>Forcing huge logic into one flow. A flow with 80 elements is harder to read than a short class.<\/li>\n\n<li>Mixing a trigger and a flow on the same object without a plan. They can fight each other and cause loops.<\/li>\n\n<li>Ignoring who maintains it. If your team has no developer, code becomes a risk.<\/li>\n\n<li>Forgetting limits. Both clicks and code share the same governor limits in a transaction.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Declarative vs Programmatic Design<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start with standard features, then clicks, then code. This keeps the org simple.<\/li>\n\n<li>Write down why you chose code, so future teammates understand the reason.<\/li>\n\n<li>Keep one automation strategy per object, so flows and triggers do not clash.<\/li>\n\n<li>Use invocable Apex to give admins code-powered actions inside Flow.<\/li>\n\n<li>Review old automation each year, because new click features may replace old code.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pick three rules from your own org or from Bright Path Tutors. For each one, run the six-question checklist from this post. Then decide whether you would use clicks or code. Hint: if you choose code for all three, check question 2 again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/platform_dev_basics\" target=\"_blank\" rel=\"noopener noreferrer\">Trailhead: Platform Development Basics<\/a><\/li>\n\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/flow-basics\" target=\"_blank\" rel=\"noopener noreferrer\">Trailhead: Flow Builder basics<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_dev_guide.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Apex Developer Guide<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Declarative tools use clicks, while programmatic tools use code.<\/li>\n\n<li>The declarative vs programmatic choice affects how easy a feature is to maintain.<\/li>\n\n<li>Start with standard features, then Flow, then Apex.<\/li>\n\n<li>Use code for complex logic, large data, custom screens and integrations.<\/li>\n\n<li>Many good solutions mix both, such as Flow calling Apex.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we look under the hood with <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-multi-tenant-architecture-metadata\/\">Salesforce multi-tenant architecture and metadata<\/a>. It explains why Salesforce has limits and how your org works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Declarative vs Programmatic is the first big choice every Salesforce developer makes on every task. Should you build it with clicks, or should you&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1173,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[8,96],"tags":[28,15,7,97],"swapz_series":[],"class_list":["post-1176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","category-salesforce-developer","tag-automation","tag-beginner","tag-salesforce","tag-salesforce-developer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Declarative vs Programmatic: When to Write Code<\/title>\n<meta name=\"description\" content=\"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Declarative vs Programmatic: When to Write Code\" \/>\n<meta property=\"og:description\" content=\"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-01T05:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\"},\"headline\":\"Declarative vs Programmatic in Salesforce: When to Write Code\",\"datePublished\":\"2026-09-01T05:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/\"},\"wordCount\":1716,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/declarative-vs-programmatic-salesforce-featured.png\",\"keywords\":[\"Automation\",\"Beginner\",\"Salesforce\",\"Salesforce Developer\"],\"articleSection\":[\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/\",\"name\":\"Declarative vs Programmatic: When to Write Code\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/declarative-vs-programmatic-salesforce-featured.png\",\"datePublished\":\"2026-09-01T05:30:00+00:00\",\"description\":\"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/declarative-vs-programmatic-salesforce-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/declarative-vs-programmatic-salesforce-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Declarative vs Programmatic featured image: title card with a balance scale\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/declarative-vs-programmatic-salesforce\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Declarative vs Programmatic in Salesforce: When to Write Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Declarative vs Programmatic: When to Write Code","description":"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/","og_locale":"en_US","og_type":"article","og_title":"Declarative vs Programmatic: When to Write Code","og_description":"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.","og_url":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-09-01T05:30:00+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a"},"headline":"Declarative vs Programmatic in Salesforce: When to Write Code","datePublished":"2026-09-01T05:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/"},"wordCount":1716,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png","keywords":["Automation","Beginner","Salesforce","Salesforce Developer"],"articleSection":["Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/","url":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/","name":"Declarative vs Programmatic: When to Write Code","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png","datePublished":"2026-09-01T05:30:00+00:00","description":"Declarative vs Programmatic in Salesforce made simple: compare clicks and code, see real examples and learn a clear rule for when to write Apex.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/declarative-vs-programmatic-salesforce-featured.png","width":2400,"height":1260,"caption":"Declarative vs Programmatic featured image: title card with a balance scale"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Declarative vs Programmatic in Salesforce: When to Write Code"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=1176"}],"version-history":[{"count":0,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1176\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/1173"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=1176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=1176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=1176"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=1176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}