Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Run custom workflow updates in isolation AKA: Proper Data Management

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm trying to solve a simple issue with updating data in MDO-CRM Version 1710 (9.1.0.4633) online.

Problem:

A process was created previously which incorrectly set a field value on case (incident) records. I need a bulk data operation to fix the incorrect data.

I wrote a simple custom workflow which can be triggered on-demand to run through the records and update the bad data.

This workflow has to re-open closed records in order to be allowed to actually write to the record (because that's awesome), write the update, then close the record with the same status code etc.

I've done all this but of course there's another problem (it's CRM right). Legacy workflows, which are setup to execute on status change, are triggered by the fact that I change the status when I open/close the records.

I need a way to run my code in isolation from the other business logic of the application. This is just standard developer stuff. Why would I do maintenance through a business logic layer? After searching around I found exactly 1 article that eluded to the fact that you could do this with an on-demand workflow but of course the article was written by a consultant agency (blog advertising tripe) and they failed to elucidate on how exactly to isolate my code.

Alternately I've considered throwing out my custom workflow code and simply writing a console application using the xrm tooling common data (whatever they call it) classes to perform the same operations. My concern here is that I spend the time to do so only to find that this too triggers business logic in the same way my custom workflow does.

Anyway CRM makes me a sad developer. I know it makes money for consultants and MS but this is such a waste of money if you're a developer looking for productivity. This is a 15 minute job in a real developer environment. I wrote the solution in 1/4 day and spent the next 2 attempting to overcome impediments built into the application.

Anyone have a way to isolate my code or an alternate solution or know if I re-write as specified above if this will trigger the same business logic issues?

Thanks Very Much,

BugDug (really don't bug me, I gotta change this name, what was I thinking?)

*This post is locked for comments

  • RE: Run custom workflow updates in isolation AKA: Proper Data Management

    Thank you Radu,

    No it's not a dumb question.

    Yes of course I CAN do that but I'd need to find all the legacy stuff other's have built and make sure its all off. Keep track of that manual process then turn it all back on again. Since we run CRM on several servers I'd have to repeat this multiple times. Oh and if something goes wrong... do it some more. Then the next time I have to do this sort of operation... do that all over again.

    It is a completely backward way to do things. It flies against the principle and best practices that any pro should aspire to; plus it wastes huge amounts of company resources.

    No offense to you personally you are just trying to help within the limitations of the product/environment and I truly do appreciate that.

    Also thanks very much for confirming my suspicion that re-writing the code doesn't get me anywhere with this issue.

    BugDug

  • Suggested answer
    Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: Run custom workflow updates in isolation AKA: Proper Data Management

    Hi Dug,

    Dumb question - can't you disable the workflow that gets triggered on status change, run your code to fix the faulty data and then reactivate the workflow? (Of course do this outside of business hours)

    If a workflow gets triggered on state change then this will fire regardless if you are updating the state from another workflow / plugin or outside by calling the CRM WebServices (via the XrmTooling CrmServiceClient)

    Regards,

    Radu

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…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,401 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans