{"id":119,"date":"2010-11-30T11:09:00","date_gmt":"2010-11-30T05:39:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=119"},"modified":"2010-11-30T11:09:00","modified_gmt":"2010-11-30T05:39:00","slug":"workflows-behind-the-scene","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2010\/11\/workflows-behind-the-scene\/","title":{"rendered":"Workflows &#8211; Behind the scene"},"content":{"rendered":"<p>We were recently working on designing a tool that deletes workflow job. We thought it would be easy to just filter out all job that related to a workflow by the workflow id and then delete that\u2019s it.<br \/>\nBut like always we were in for a surprise. Just thought putting it down would help others in resolving this mystery.<br \/>\nEach Workflow has a unique id just like any other entity. But if you search for workflow jobs using this id to look for all jobs related to this workflow, you would be in for a surprise. It would not return all of the jobs that you are expecting. The reason being each time you revise a workflow i.e unpublish and publish the workflow once again, it creates a new workflow entry in the tables. If you want to look for the workflow jobs related to a particular workflow then you need to look for the workflow id assigned to each of its versions.<br \/>\nFor workflow, you would find the following definitions available in the tables.<br \/>\n<a href=\"http:\/\/2.bp.blogspot.com\/_pMlyDuF-ngc\/TPTyzmZptsI\/AAAAAAAAAm8\/hcZdjUOQPJs\/s1600\/image0001.png\"><img decoding=\"async\" src=\"http:\/\/2.bp.blogspot.com\/_pMlyDuF-ngc\/TPTyzmZptsI\/AAAAAAAAAm8\/hcZdjUOQPJs\/s400\/image0001.png\" alt=\"\" border=\"0\" \/><\/a><br \/>\nThere will be only 1 definition record in CRM for a workflow no matter how many times you revise it.<br \/>\n<a href=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TPTtFIlcLvI\/AAAAAAAAAmc\/Z8-4K6gT740\/s1600\/image001.png\"><img decoding=\"async\" src=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TPTtFIlcLvI\/AAAAAAAAAmc\/Z8-4K6gT740\/s400\/image001.png\" alt=\"\" border=\"0\" \/><\/a><br \/>\nBut each time you publish a workflow it will create a new activation record.<br \/>\n<a href=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TPTtwpNXTxI\/AAAAAAAAAmk\/g5YEbNJ1HkQ\/s1600\/image003.png\"><img decoding=\"async\" src=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TPTtwpNXTxI\/AAAAAAAAAmk\/g5YEbNJ1HkQ\/s400\/image003.png\" alt=\"\" border=\"0\" \/><\/a><br \/>\nThe activation workflow record will have its parent workflowid set to the workflow definition id.<br \/>\nThe workflow definition record will store the id of the currently active version of the workflow.<br \/>\nIf you unpublish a worklfow and publish it again, it will add another row to the table and the status would now be as follows:<br \/>\n<a href=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TPTuJ7SOECI\/AAAAAAAAAms\/vE_tUyoBP34\/s1600\/image005.png\"><img decoding=\"async\" src=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TPTuJ7SOECI\/AAAAAAAAAms\/vE_tUyoBP34\/s400\/image005.png\" alt=\"\" border=\"0\" \/><\/a><br \/>\nNote the activeworkflowid of the Definition record now refers the Guid of the latest version of the workflow that is published.<br \/>\nNow if you want to look for system jobs for this workflow, you will need to search for jobs that have their workflowactivationid set to any of the workflowid listed above in the table.<br \/>\nHope this helps you find your way through the maze of workflows!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We were recently working on designing a tool that deletes workflow job. We thought it would be easy to just filter out all job that related to a workflow by the workflow id and then delete that\u2019s it. But like always we were in for a surprise. Just thought putting it down would help others\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2010\/11\/workflows-behind-the-scene\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"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":[19,67],"tags":[494,745,1693],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","category-workflows","tag-delete","tag-error","tag-system-job"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/119","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=119"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/119\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}