https://dynamicscrmclub.files.wordpress.com/2022/12/captured.png
Now, in case you are working on forms in Dynamics 365 CRM, and you want to know what all data is changed – There are 2 ways to get this
Scenario
Let’s look at the below scenario where this is useful –
- You have a record which you are about to Edit. This is how it looks as of now.
- Now, I have an OnSave event on which I’m calling a function to capture what all is being saved.
- Now, below is what I want to change and then click Save to save the changes.
- And then click Save. Now, I want to capture all this data upon Saving to know and further process what has been changed. Let’s see how we can achieve this using Dynamics 365 CRM JavaScript
getDataXml() method
Here’s how you will see the data to be changed
- Below, you see that I’m using
formContext.data.entity.getDataXml();
to get the data that was changed and which will be setn to the server to saving/processing.
Please note that here, I’ve used formContext as my variable to store the context passed from the Save event on the form.Here’s the code for you to copy and change for yourself –
var xmlData = formContext.data.entity.getDataXml();
- Now, when I run this on the Dev Tools in the Browser, I can see what is being populated when I save the record.
- Once I hit debugger, I’ll get the same in the variable I created.
- And when I run this variable in the Console to see the complete data, I get this in XML.
- And that’s how you can capture data in Dynamics 365 which is being sent to the server for processing/saving.
Hope this helps!
Here are some Power Automate posts you want to check out –
- Select the item based on a key value using Filter Array in Power Automate
- Select values from an array using Select action in a Power Automate Flow
- Blocking Attachment Extensions in Dynamics 365 CRM
- Upgrade Dataverse for Teams Environment to Dataverse Environment
- Showing Sandbox or Non Production Apps in Power App mobile app
- Create a Power Apps Per User Plan Trial | Dataverse environment
- Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
- Co-presence in Power Automate | Multiple users working on a Flow
- Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
- Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
- Call a Flow from Canvas Power App and get back response | Power Platform
- FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
- Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
- Asynchronous HTTP Response from a Flow | Power Automate
- Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
- Converting JSON to XML and XML to JSON in a Flow | Power Automate
Thank you!