Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Real Time workflow issue

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Real Time workflow issue

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Real Time workflow issue

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Real Time workflow issue

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Real Time workflow issue

    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...

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Real Time workflow issue

    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".

  • Verified answer
    Nuno Profile Picture
    Nuno 2,005 on at
    RE: Real Time workflow issue

    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

     

  • Suggested answer
    Hosk Profile Picture
    Hosk on at
    RE: Real Time workflow issue

    Can't you use the workflow to change the status of the record, amend  the fields and then change the status back

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans