{"id":193,"date":"2012-07-26T19:54:36","date_gmt":"2012-07-26T18:54:36","guid":{"rendered":"http:\/\/www.darrencoupland.com\/blog\/?p=193"},"modified":"2012-08-15T22:09:30","modified_gmt":"2012-08-15T21:09:30","slug":"modifying-batch-job-statuses-in-a-non-production-environment","status":"publish","type":"post","link":"https:\/\/www.darrencoupland.com\/blog\/2012\/07\/modifying-batch-job-statuses-in-a-non-production-environment\/","title":{"rendered":"Modifying Batch Job Statuses in a Non-Production Environment"},"content":{"rendered":"<p>There&#8217;s a few things you can do when undertaking your data refresh into a non-production environment one of them is modifying your batch jobs to &#8216;Withhold&#8217; status ensuring they won&#8217;t start to run when you after you start up your AOS&#8217;s and then configure your batch server settings. After the script has been ran you can set the status of jobs you want to run back to &#8216;Waiting&#8217; status at a later point during the data refresh process, happy in the knowledge that you know no batch jobs are going to start emailing customers or update\/talk to other external systems.<\/p>\n<p>SQL Script:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">-- Change to correct DB\r\n USE &lt;Your Ax Database&gt;\r\n-- Set all Batch Jobs to Withhold status\r\n UPDATE BatchJob\r\n SET status = 0<\/pre>\n<p>You could also have a scenario where only certain batch jobs should be set to Withhold status, you could do this by adding the batch jobs you want to continue to run into a table and then only update the ones not in that table to Withhold. An example script to do this can be found below:<\/p>\n<p>Pre-Requisites: Create a table with one data field called &#8216;Caption&#8217;, populate table with batch job names that you want to continue to run in your non-production environment (e.g. not be at withhold status)<\/p>\n<p>SQL Script:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">-- Change to correct DB\r\nUSE &lt;Your Ax Database&gt;\r\n\r\nUPDATE BatchJob\r\nSET status = 0\r\nWHERE\r\nCaption NOT IN (SELECT Caption FROM &lt;the table name created in pre-requisites&gt;)<\/pre>\n<p>Disclaimer: Ensure any batch jobs you add to this table don&#8217;t have other parameters that need to be changed prior to them running again in the non-production environment.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>There&#8217;s a few things you can do when undertaking your data refresh into a non-production environment one of them is modifying your batch jobs to &#8216;Withhold&#8217; status ensuring they won&#8217;t start to run when you after you start up your AOS&#8217;s and then configure your batch server settings. After the script has been ran you can set the status of jobs you want to run back to &#8216;Waiting&#8217; status at a later point during the data refresh process, happy in the knowledge that you know no batch jobs are going to start emailing customers or update\/talk to other external systems<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[29,8,27,25,28],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-dynamics-ax-2009","tag-administration","tag-ax2009","tag-nonproduction","tag-scripts","tag-t-sql"],"_links":{"self":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":1,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":555,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions\/555"}],"wp:attachment":[{"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.darrencoupland.com\/blog\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}