Nelson
Yes, there seems to be no benefit to mark workflows with Succeed(especially with self destruct workflows).
But in situations where keeping a workflow log for audits is required, it may be needed. One could argue that a successful run status is enough to indicate that it succeeded, but how do you know for sure? What if one of those steps just decided to quit for some unknown reason?
Ex:
If (GoToFunctionThatReturnsTrue(SomeParameter))
else
Canceled
Now one can "assume" (and we know what that word stands for :) ) that if it doesn't return cancel then it succeeded, but we all know that is not true.
If (GoToFunctionThatReturnsTrue(SomeParameter))
Succeeded
else
Canceled
In this case we KNOW for sure that the function worked and returned a true value because Succeeded was returned.
So basically you are sacrificing certainty if you don't return a Succeeded value. This can be VERY PAINFUL during audits.
It's the same argument in the SQL realm, is a null bit field false? We know common sense would say, well if it's not checked then it's false. But SQL developers know that is not the case.
https://softwareengineering.stackexchange.com/questions/133600/should-i-store-false-as-null-in-a-boolean-database-field
------------------------------
Rex Kenley Tan, MCP
Tallmadge OH
https://www.youracclaim.com/users/rex-kenley-tan*Always be CURRENT with JavaScript & C#, NEVER be obsolete.
DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
------------------------------
Original Message:
Sent: Apr 26, 2019 09:40 AM
From: Nelson Johnson
Subject: Stop Workflow Step question
Great response Rex. I completely understand the use of Stop Workflow with Cancelled status in those scenarios. My issue is really around the fact that people are being taught to use Stop Workflow with Success at the end of their workflows. I have been using CRM since v3, and here is my problem with the advice provided in the blog you cited - there is absolutely no evidence that adding the Stop Workflow with Success at the end of a workflow provides any benefit.
I am the kind of personality that questions why people do things and I am not a fan of blind dogma. I believe that this advice is being passed out because there are non-programmers among us that cannot deal with IF conditions more than 1 deep and it is easier to tell them to just put it everywhere instead of trying to give them rules.
------------------------------
If this answered your question, please click on the arrow button next to Reply Inline and choose 'Make Best Answer.'
Thanks.
Nelson Johnson, Solution Architect
BroadPoint, Inc., Bethesda MD
Link with me! https://www.linkedin.com/in/nelsonjohnson/
Original Message:
Sent: Apr 26, 2019 07:22 AM
From: Rex Kenley Tan
Subject: Stop Workflow Step question
Nelson
It is basically a "return" value.
Always try to cleanly end workflows. Use Stop Workflow steps wherever possible to ensure all workflow logic exits cleanly and no system resources are consumed unnecessarily. Stopping a workflow with Cancel or Success can help evaluate the status of workflows after they run.
https://crmbook.powerobjects.com/system-administration/processes/managing-processesbest-practices/
Stop Workflow step makes Dynamics 365 behave differently on real-time workflow compared to background workflow. While the workflow design is exactly the same in both scenarios, real-time workflows rolls back the transaction, if workflow is stopped with status Canceled. This is due to the fact that real-time workflows behaves same as a post-operation plugin which if failed rolls back the complete transaction.
Since the background workflow runs outside of the main transaction, it executes each step independently and when workflow is stopped with Canceled status, complete transaction is not rolled back.
http://dyn365apps.com/2017/03/29/kb-dynamics-365-workflow-step-stop-workflow-succeeded-vs-canceled-cancelled/
**Although, I am a bit concerned about what the author said of background workflows NOT rolling back when Cancelled.
------------------------------
Rex Kenley Tan, MCP
Tallmadge OH
https://www.youracclaim.com/users/rex-kenley-tan
*Always be CURRENT with JavaScript & C#, NEVER be obsolete.
DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
Original Message:
Sent: Apr 26, 2019 05:46 AM
From: Chris Harrington
Subject: Stop Workflow Step question
Yeah, I see that in workflows too and never understood it. If I see it, I usually delete that step. :)
------------------------------
Chris Harrington
Solutions Architect
PowerObjects, an HCL Company
Original Message:
Sent: Apr 25, 2019 02:58 PM
From: Nelson Johnson
Subject: Stop Workflow Step question
I have a question about the use of 'Stop Workflow' with status of Success. Can anyone explain (with evidence) why it should be used at the end of a workflow? I cannot find any blog posts, or documentation that explains why so many people are being told to put it at the end of every workflow. So far, everyone I have asked just shrugs and says "I was told to do that" and I feel it is not a best practice.
I can (sort of) understand using it in the middle of a workflow, for example if the person is not a programmer and cannot understand IF logic more than 1 level deep and therefore they are taught to use it to prevent unexpected things to happen. But I cannot understand why people are being trained to put it at the end of every workflow.
------------------------------
Thanks.
Nelson Johnson, Solution Architect
BroadPoint, Inc., Bethesda MD
Link with me! https://www.linkedin.com/in/nelsonjohnson/
------------------------------