Reputation: 6715
From the MSDN article on the JS Xrm object
getDataXml
Returns a string representing the XML that will be sent to the server when the record is saved.
Only data in fields that have changed are sent to the server.
<account>
<name>Contoso</name>
<accountnumber>55555</accountnumber>
<telephone2>425 555-1234</telephone2>
</account>
Does anyone know if there is an equivalent set method or any way to mimic it? I'm just experimenting and wondered if anyone had tried anything similar?
Ultimately I'm interested in dynamically passing information to a plugin. Obviously one way is to hide a field on a form, and populate it as and when. It may well be that I have to do that. But it would be much easier if I could pass a flag 'foo' to the plugin, detect it there and perform logic A, B or C depending on it without relying on the entity having the flag field.
I know this isn't quite a typical stack question so I will understand votes to close!
Upvotes: 2
Views: 206
Reputation: 8109
I haven't looked into it from Javascript and Form Submits. But for certain tasks where we use the Organization Web Service we add extra headers (using WCF Client Message Inspector) to the Http Request which the plugin then reads.
Upvotes: 0
Reputation: 17552
I dont believe that Xrm object is exposing any additional functionality, its just showing what has been set on the form and what will be passed with the save message. Although it might be slightly different under the hood, ultimately I don't believe that would be any different than a Create service call.
As you suggested to achieve 'passing data to plugins' you have to place it on the form as a field.
The only other way I know how to pass data to plugins is on the event execution pipeline, but this requires another plugin to add the information, so I don't think thats going to help you here.
Upvotes: 1