Power Community

Power Community

Get Data sent to server on Save using Dynamics 365 CRM JavaScript | GetDataXML function

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 –

  1. You have a record which you are about to Edit. This is how it looks as of now.
  2. Now, I have an OnSave event on which I’m calling a function to capture what all is being saved.
  3. Now, below is what I want to change and then click Save to save the changes.
  4. 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

  1. 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();

  2. Now, when I run this on the Dev Tools in the Browser, I can see what is being populated when I save the record.
  3. Once I hit debugger, I’ll get the same in the variable I created.
  4. And when I run this variable in the Console to see the complete data, I get this in XML.
  5. 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 –

  1. Select the item based on a key value using Filter Array in Power Automate
  2. Select values from an array using Select action in a Power Automate Flow
  3. Blocking Attachment Extensions in Dynamics 365 CRM
  4. Upgrade Dataverse for Teams Environment to Dataverse Environment
  5. Showing Sandbox or Non Production Apps in Power App mobile app
  6. Create a Power Apps Per User Plan Trial | Dataverse environment
  7. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  8. Co-presence in Power Automate | Multiple users working on a Flow
  9. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  10. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  11. Call a Flow from Canvas Power App and get back response | Power Platform
  12. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  13. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  14. Asynchronous HTTP Response from a Flow | Power Automate
  15. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  16. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Use solutions with Power Pages Through Power Apps- Part 1

Introduction In the dynamic landscape of digital solutions, staying ahead of the curve is paramount for businesses striving to make...

More Articles Like This

- Advertisement -spot_img