Hi,
I want to use a C# plugin in D365 to preserve the previous 'ModifiedOn' value when the statecode changes from 0 (Open) to 1 (Completed) for a entity record
Please provide a example of how to implement this functionality.
Thanks in advance.
Hi,
I want to use a C# plugin in D365 to preserve the previous 'ModifiedOn' value when the statecode changes from 0 (Open) to 1 (Completed) for a entity record
Please provide a example of how to implement this functionality.
Thanks in advance.
Yeah, I kinda said that already Nya.
Hi,
It is recommended to achieve your request with a Flow.
Here is an example which will output the Modified On field when an opportunity’s Status Reason turns into Won.
And when an opportunity is Closed as Won, the Modified On will be output as the following:
Of course, you can also create a custom field and fill the field with this value via the flow.
Hi Vivek,
I would first ask why you want to using a plugin for this? Whether you're using on-prem or cloud D365 (I'm assuming you're referring to D365 CE, not BC and definitely not F&O), plugins should be a last resort. And if you only want to preserve a single data value like that you could easily create a custom field on the entity for the previous value and have an automated cloud flow in Power Automate that triggers when the ModifiedOn value changes and pushes the previous value to the new field.
One thing that a lot of people haven't run into with the Horrified UI (ooops, Unified UI), is that, for whatever insane reason, MS architected it using a procedural pattern where plugins sit chronologically on top of each other. For instance, let's say you develop and deploy this plugin that will obviously tie to pretty much all the major entities like Account, Contact, lead, and so on. Then a few months down the road, for example, you put in another plugin. Whether that is something you develop or an ISV. Then, let's say, 6 months after that, you come across a great ISV solution that your org really wants to use but when you test it it conflicts with the first plugin. So, you need to remove the plugin. Guess what though? You can't remove the first one until you remove the SECOND one. And loose whatever data the 2nd one managed. And this actually happens even with MS' own apps.
If you want to go to the effort I went through, you can actually see this for yourself. Start with a vanilla Sales Pro environment. Add D365 marketing. Create a plugin that references the major entities like contacts, leads, accounts, etc. Create some data. The, add in an ISV solution that also references those entities. Then, try to remove the Marketing app. MS support gave up trying to remove the Marketing app (which is THEIR marketing app!) from my environment after 3.5 months of support effort.
So, that was the first thing. The second thing is that are you aware that, if you have auditing enabled for the entity, you can access the audit logs through M365 Compliance Center (not D365) and the logs will give you that ModifiedOn date change info?
André Arnaud de Cal... 291,885 Super User 2024 Season 2
Martin Dráb 230,569 Most Valuable Professional
nmaenpaa 101,156