{"id":2211,"date":"2012-10-29T05:06:47","date_gmt":"2012-10-29T05:06:47","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=2211"},"modified":"2022-08-21T15:57:34","modified_gmt":"2022-08-21T15:57:34","slug":"fim-best-practice-create-single-function-workflows","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/fim-best-practice-create-single-function-workflows","title":{"rendered":"FIM Best Practice: Create single function Workflows"},"content":{"rendered":"<p>As much as possible I like to keep my Workflows simple with a minimum number of steps. When updating attributes I prefer, wherever possible, to only update a single attribute per Workflow Definition. So for example I&#8217;ll have separate Workflows for &#8220;Set DisplayName&#8221; and &#8220;Set AccountName&#8221; rather than rolling the two together in a single &#8220;Set Attributes on Creation&#8221; Workflow.<\/p>\n<p><!--more--><\/p>\n<p>There are a few advantages to this approach:<\/p>\n<ul>\n<li>When you look at the list of Workflows triggered by a MPR it is really easy to see what they&#8217;re doing without having to drill down into the Workflow Definitions themselves.<\/li>\n<li>The Workflows are re-usable: that &#8220;Set DisplayName&#8217; workflow can be used both at object creation and when a name is changed.<\/li>\n<li>You&#8217;re less likely to inadvertently run two workflows at the same time that update the same attribute resulting in the dreaded &#8220;SQL insert duplicate&#8221; error and a failure of the activity.<\/li>\n<\/ul>\n<p>Of course there are good reasons to run multiple steps in one Workflow Definition, in particular where you need to ensure a certain order. This best practice does not negate such requirements. However more often than not we pile extra steps into an existing Definition because it seems quicker and easier at the time, when for the sake of clarity, and long-term reusability, we&#8217;d be better off creating new Workflows for those extra steps.<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As much as possible I like to keep my Workflows simple with a minimum number of steps. When updating attributes I prefer, wherever possible, to only update a single attribute per Workflow Definition. So for example I&#8217;ll have separate Workflows for &#8220;Set DisplayName&#8221; and &#8220;Set AccountName&#8221; rather than rolling the two together in a single&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[55,42,45],"tags":[],"class_list":["post-2211","post","type-post","status-publish","format-standard","hentry","category-best-practice","category-fim-2010","category-workflow"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-zF","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=2211"}],"version-history":[{"count":14,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2211\/revisions"}],"predecessor-version":[{"id":3275,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/2211\/revisions\/3275"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=2211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=2211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=2211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}