I really hope I am missing something here. I am trying to get a real time workflow to behave but I seem to be in a catch 22...
The workflow runs on creation, before a status change or when a field is updated. At least it would ideally. In this case I need the workflow to run AFTER a field is updated, but BEFORE the status changes. It appears as if the Start When is the same for change status AND field is changed (see below)...
Here is what I want to happen. We have a custom entity (Installation) that tracks our software installations at our customer sites. We want to copy a variety of specifics from the installation record to the OOB Case record in CRM. Everything works fine if the installation (serial Number) is on the case when it is created, but if it is added afterwards we seem to be stuck.
If I check the record status changes check box, it just seems to check the Status field of the "Record fields change" option under the covers. This is where the problem comes in. If I try to update the associated Case record after it is resolved it throws an error because you can't update a closed record. If I try to update the record before the Installation ID changes I don't get the right results because it is using the previous installation id (usually blank).
How do I get a real time workflow to update the record prior to it being closed, but after a field value is changed?
*This post is locked for comments
Thanks for all of the responses they reflected what I suspected and the ideas I had of working around it... In the end I admit none of the options excite me, but talking to the users I asked why they were requesting it to fire on the change status and they mentioned they would update installation record details, but forget to run the workflow manually and they didn't change the serial number after the update so the cases were being closed with stale data. Discussing it with them a Dialog to facilitate the installation update came up and they really liked the idea of not having to navigate away from the case edit and then come back. I just added the execute of the workflow as a dialog step and it seems like it might work. I don't need to run the workflow prior to closing the case now and the real time workflow is doing just fine running after the serial number updates... Almost all of the other suggestions would have worked, not sure I can mark them all answers.
I was prepared for the two workflow solution, all though I still suggest I should be able to set different Before / After settings for field change, status change and record assignment. In the end after talking to the users I may not need to accept the dual maintenance of two workflows. I think a dialog can solve my users needs.
Thanks for responding though.
Yeah I saw that when I had checked "Record Status Changes" is checked it selects the Status Field from the Fields for the Record Fields change same for owner it appears. This isn't really ideal but cest la vie. I was trying to avoid a plug in here if at possible though I seem to be developing plug in creep in our CRM Environment and I am resisting further ones until I can get some guidance in place for our developers. Thanks for the links though, they were helpful none the less.
I could, but I don't have access to the case resolve activity, so I was trying to avoid this as the solution... Thanks for the thought though it was one I considered too...
You want it to run after the transaction has been committed but before the transaction has been committed. This is fundamentally not possible.
Also note the triggers for a workflow are always "OR" so if you set more than one the workflow will run when the status changes OR when the field is updated.
Two workflows might work best for you here:
One after the field changes, that checks if the Case is already closed (always check things like this so WF does not fail) and then copies the values it needs.
Another that runs before a Case status changes, checks if the serial number is already filled in and Stops as Canceled if it is not. So if a user fills in the s/n and Resolves without doing a Save in between, this will mean the transaction is stopped and a modal dialog box is shown to the user with an error of your choice (set in the properties of the Stop step in the Workflow). Something like "Because you left it until now to fill in the serial number, you need to Save the Case record before trying to Resolve it".
Hi,
For real-time workflows it looks like that the start when is always the same for record status changes and for record fields change.
So, if you want to update the record prior to it being closed, but after a field value is changed, you may do this through a plugin:
- with a step on pre-operation of setstatedynamicentity (prior change the status)
http://nishantrana.me/2010/01/29/plug-in-for-setstate-and-setstatedynamicentity-messages
- and a step on post-operation of update (use filter attribute, to execute this step only when that field is updated)
http://mscrmshop.blogspot.pt/2012/02/use-of-filtering-attributes-during.html
Can't you use the workflow to change the status of the record, amend the fields and then change the status back
André Arnaud de Cal...
292,031
Super User 2025 Season 1
Martin Dráb
230,868
Most Valuable Professional
nmaenpaa
101,156