{"id":143,"date":"2022-11-12T04:12:47","date_gmt":"2022-11-11T23:12:47","guid":{"rendered":"http:\/\/doozyspot.com\/?p=143"},"modified":"2022-11-12T04:15:35","modified_gmt":"2022-11-11T23:15:35","slug":"salesforce-batch-apex-start-did-not-return-a-valid-iterable-object","status":"publish","type":"post","link":"https:\/\/doozyspot.com\/?p=143","title":{"rendered":"Salesforce Batch apex Start did not return a valid iterable object"},"content":{"rendered":"\n<p>I have below batch apex code when I try to pass certain parameters through parameterized Constructor, I am getting apex batch error as &#8220;Start did not return a valid iterable object&#8221;<\/p>\n\n\n\n<p>Here is the apex batch code.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>global class DZBatchClass implements Database.Batchable {\r\nglobal string query;\r\nList ids;\r\nString dz;\n\nglobal DZBatchClass(List&lt;Id> lstIds, String dz) {\n    this.ids= lstIds;\n    this.dz = dz;\n}\n\nglobal Iterable&lt;Id> start(Database.BatchableContext BC){\n    System.debug('###########'+ids);\n    return ids;\n}\n\nglobal void execute(Database.BatchableContext BC, List&lt;Id> idsToProcess) {\n   \/\/ Execute logic\n}\n\nglobal void finish(Database.batchableContext bc){ \n    \/\/Finish method\n}\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Got it fixed by below change in the Apex Batch Class Constructor<br><\/p>\n\n\n\n<pre id=\"ext-gen19\" class=\"wp-block-code\"><code>global BatchClass(List&lt;Id&gt; ids,String type) {\n       this.ids= lstIds;\n       this.dz = dz;\n        System.debug(ds+ 'is the String and Ids are : '+ids);\n    }<\/code><\/pre>\n\n\n\n<p><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have below batch apex code when I try to pass certain parameters through parameterized Constructor, I am getting apex batch error as &#8220;Start did not return a valid iterable object&#8221; Here is the apex batch code. Got it fixed by below change in the Apex Batch Class Constructor<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Salesforce Batch apex Start did not return a valid iterable object - DoozySpot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/doozyspot.com\/?p=143\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Salesforce Batch apex Start did not return a valid iterable object - DoozySpot\" \/>\n<meta property=\"og:description\" content=\"I have below batch apex code when I try to pass certain parameters through parameterized Constructor, I am getting apex batch error as &#8220;Start did not return a valid iterable object&#8221; Here is the apex batch code. Got it fixed by below change in the Apex Batch Class Constructor\" \/>\n<meta property=\"og:url\" content=\"http:\/\/doozyspot.com\/?p=143\" \/>\n<meta property=\"og:site_name\" content=\"DoozySpot\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-11T23:12:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-11T23:15:35+00:00\" \/>\n<meta name=\"author\" content=\"doozyspot\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"doozyspot\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/doozyspot.com\/?p=143#article\",\"isPartOf\":{\"@id\":\"http:\/\/doozyspot.com\/?p=143\"},\"author\":{\"name\":\"doozyspot\",\"@id\":\"https:\/\/doozyspot.com\/#\/schema\/person\/bccb52398479b1354683df33f84154d6\"},\"headline\":\"Salesforce Batch apex Start did not return a valid iterable object\",\"datePublished\":\"2022-11-11T23:12:47+00:00\",\"dateModified\":\"2022-11-11T23:15:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/doozyspot.com\/?p=143\"},\"wordCount\":60,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/doozyspot.com\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/doozyspot.com\/?p=143#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/doozyspot.com\/?p=143\",\"url\":\"http:\/\/doozyspot.com\/?p=143\",\"name\":\"Salesforce Batch apex Start did not return a valid iterable object - DoozySpot\",\"isPartOf\":{\"@id\":\"https:\/\/doozyspot.com\/#website\"},\"datePublished\":\"2022-11-11T23:12:47+00:00\",\"dateModified\":\"2022-11-11T23:15:35+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/doozyspot.com\/?p=143#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/doozyspot.com\/?p=143\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/doozyspot.com\/?p=143#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/doozyspot.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Salesforce Batch apex Start did not return a valid iterable object\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/doozyspot.com\/#website\",\"url\":\"https:\/\/doozyspot.com\/\",\"name\":\"DoozySpot\",\"description\":\"One of its kind in knowledge base\",\"publisher\":{\"@id\":\"https:\/\/doozyspot.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/doozyspot.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/doozyspot.com\/#organization\",\"name\":\"DoozySpot\",\"url\":\"https:\/\/doozyspot.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/doozyspot.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/doozyspot.com\/wp-content\/uploads\/2023\/03\/download.jpg\",\"contentUrl\":\"http:\/\/doozyspot.com\/wp-content\/uploads\/2023\/03\/download.jpg\",\"width\":1200,\"height\":1200,\"caption\":\"DoozySpot\"},\"image\":{\"@id\":\"https:\/\/doozyspot.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/doozyspot.com\/#\/schema\/person\/bccb52398479b1354683df33f84154d6\",\"name\":\"doozyspot\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/doozyspot.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2584f56a7b7945fd49a8fdf22dd31fa7baf3cf6f10370736f2d2895c7d9219f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2584f56a7b7945fd49a8fdf22dd31fa7baf3cf6f10370736f2d2895c7d9219f4?s=96&d=mm&r=g\",\"caption\":\"doozyspot\"},\"sameAs\":[\"http:\/\/doozyspot.com\"],\"url\":\"https:\/\/doozyspot.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Salesforce Batch apex Start did not return a valid iterable object - DoozySpot","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":"http:\/\/doozyspot.com\/?p=143","og_locale":"en_US","og_type":"article","og_title":"Salesforce Batch apex Start did not return a valid iterable object - DoozySpot","og_description":"I have below batch apex code when I try to pass certain parameters through parameterized Constructor, I am getting apex batch error as &#8220;Start did not return a valid iterable object&#8221; Here is the apex batch code. Got it fixed by below change in the Apex Batch Class Constructor","og_url":"http:\/\/doozyspot.com\/?p=143","og_site_name":"DoozySpot","article_published_time":"2022-11-11T23:12:47+00:00","article_modified_time":"2022-11-11T23:15:35+00:00","author":"doozyspot","twitter_card":"summary_large_image","twitter_misc":{"Written by":"doozyspot","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/doozyspot.com\/?p=143#article","isPartOf":{"@id":"http:\/\/doozyspot.com\/?p=143"},"author":{"name":"doozyspot","@id":"https:\/\/doozyspot.com\/#\/schema\/person\/bccb52398479b1354683df33f84154d6"},"headline":"Salesforce Batch apex Start did not return a valid iterable object","datePublished":"2022-11-11T23:12:47+00:00","dateModified":"2022-11-11T23:15:35+00:00","mainEntityOfPage":{"@id":"http:\/\/doozyspot.com\/?p=143"},"wordCount":60,"commentCount":0,"publisher":{"@id":"https:\/\/doozyspot.com\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/doozyspot.com\/?p=143#respond"]}]},{"@type":"WebPage","@id":"http:\/\/doozyspot.com\/?p=143","url":"http:\/\/doozyspot.com\/?p=143","name":"Salesforce Batch apex Start did not return a valid iterable object - DoozySpot","isPartOf":{"@id":"https:\/\/doozyspot.com\/#website"},"datePublished":"2022-11-11T23:12:47+00:00","dateModified":"2022-11-11T23:15:35+00:00","breadcrumb":{"@id":"http:\/\/doozyspot.com\/?p=143#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/doozyspot.com\/?p=143"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/doozyspot.com\/?p=143#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/doozyspot.com\/"},{"@type":"ListItem","position":2,"name":"Salesforce Batch apex Start did not return a valid iterable object"}]},{"@type":"WebSite","@id":"https:\/\/doozyspot.com\/#website","url":"https:\/\/doozyspot.com\/","name":"DoozySpot","description":"One of its kind in knowledge base","publisher":{"@id":"https:\/\/doozyspot.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/doozyspot.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/doozyspot.com\/#organization","name":"DoozySpot","url":"https:\/\/doozyspot.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/doozyspot.com\/#\/schema\/logo\/image\/","url":"http:\/\/doozyspot.com\/wp-content\/uploads\/2023\/03\/download.jpg","contentUrl":"http:\/\/doozyspot.com\/wp-content\/uploads\/2023\/03\/download.jpg","width":1200,"height":1200,"caption":"DoozySpot"},"image":{"@id":"https:\/\/doozyspot.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/doozyspot.com\/#\/schema\/person\/bccb52398479b1354683df33f84154d6","name":"doozyspot","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/doozyspot.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2584f56a7b7945fd49a8fdf22dd31fa7baf3cf6f10370736f2d2895c7d9219f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2584f56a7b7945fd49a8fdf22dd31fa7baf3cf6f10370736f2d2895c7d9219f4?s=96&d=mm&r=g","caption":"doozyspot"},"sameAs":["http:\/\/doozyspot.com"],"url":"https:\/\/doozyspot.com\/?author=1"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doozyspot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":3,"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/doozyspot.com\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/doozyspot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doozyspot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doozyspot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}