{"id":15542,"date":"2019-04-22T12:46:47","date_gmt":"2019-04-22T12:46:47","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=15542"},"modified":"2022-07-21T12:12:27","modified_gmt":"2022-07-21T06:42:27","slug":"one-way-to-overcome-429-error-concurrent-requests-limit-exceeded-error-in-dynamics-365-crm-web-api","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/04\/one-way-to-overcome-429-error-concurrent-requests-limit-exceeded-error-in-dynamics-365-crm-web-api\/","title":{"rendered":"One way to overcome \u201c429\u201d error (concurrent requests limit exceeded error) in Dynamics 365 CRM Web API"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p style=\"text-align: justify;\">With JavaScript, we have real-time interaction with Dynamics 365. Microsoft gives us feasibility to use CRM Web API in JavaScript to perform operations such as Create, Update, Delete, Retrieve, etc.<\/p>\n<p style=\"text-align: justify;\">But there is a limitation on the number of API requests made by each user, per organization instance, within a five-minute sliding window. Please refer the below blog for more details:<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/customer-engagement\/developer\/api-limits\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/dynamics365\/customer-engagement\/developer\/api-limits<\/a><\/p>\n<p style=\"text-align: justify;\">This limit will cause the issue to the organization which is using a large number of requests for their application.<\/p>\n<p style=\"text-align: justify;\">The application will throw \u201c429\u201d error which will give this type of message: \u201cCombined execution time of incoming requests exceeded limit of 1,200,000 milliseconds over a time window of 300 seconds. Decrease the number of concurrent requests or reduce the duration of requests and try again later.\u201d<\/p>\n<h2><strong>Solution<\/strong><\/h2>\n<p style=\"text-align: justify;\">To overcome this error, we have used JavaScript\u2019s setTimeout() function. setTimeout() for single request works as expected but in order to use setTimeout() in <strong>for loop<\/strong> you need to add extra piece of code to get a proper result i.e. by using setTimeout() with <strong>IIFE<\/strong>\u00a0(Immediately Invoked Function Expression).<\/p>\n<p>var waitInterval = 300;<\/p>\n<p>for (var i = 0; i &lt; result.List.length; i++) {<\/p>\n<p>(function (i) {<\/p>\n<p>setTimeout(function () {<\/p>\n<p>crmAPI.Create(entityName, record).then(function success(result){<\/p>\n<p>});<\/p>\n<p>}, waitInterval * i);<\/p>\n<p>})(i);<\/p>\n<p>}<\/p>\n<p>You can change the waiting interval based on number of requests.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p style=\"text-align: justify;\">By using JavaScript\u2019s setTimeout() with <strong>IIFE<\/strong>\u00a0(Immediately Invoked Function Expression)\u00a0we can overcome the CRM API limit.<\/p>\n<h2 style=\"text-align: left;\"><div class=\"su-heading su-heading-style-default su-heading-align-center\" id=\"\" style=\"font-size:15px;margin-bottom:5px\"><div class=\"su-heading-inner\">70% of global 2000 companies apply gamification to improve productivity and returns!<\/div><\/div><\/h2>\n<p><em><strong><a href=\"https:\/\/bit.ly\/3RD4lYW\" target=\"_blank\" rel=\"noopener noreferrer\">Gamifics365<\/a> <\/strong>\u2013 Spin the magic of games within Microsoft Dynamics 365 CRM to improve user adoption, enhance productivity, and achieve company goals!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction With JavaScript, we have real-time interaction with Dynamics 365. Microsoft gives us feasibility to use CRM Web API in JavaScript to perform operations such as Create, Update, Delete, Retrieve, etc. But there is a limitation on the number of API requests made by each user, per organization instance, within a five-minute sliding window. Please\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/04\/one-way-to-overcome-429-error-concurrent-requests-limit-exceeded-error-in-dynamics-365-crm-web-api\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":18210,"comment_status":"closed","ping_status":"closed","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":[16,18,19,65],"tags":[1815,1816],"class_list":["post-15542","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-dynamics-365-v9-2","category-dynamics-crm","category-webapi","tag-web-api-dynamics-365","tag-web-api-dynamics-365-crm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/15542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=15542"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/15542\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/18210"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=15542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=15542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=15542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}