web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create XML file Dynamics 365

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I am working on a project for a client. They want to have an xml file to be generated upon the change of a 'flag' for an entity's records, it should contain a snapshot of all the fields' values regardless of what changes. This file has to then be saved onto a server or a shared folder, ready to be retrieved from another plugin.

I am very new to CRM Development and I am hoping that you guys suggest what the best way to achieve this is.

I have experience with C# programming and a little bit of JavaScript. I have already tried to search on google or other forums without luck.

Hope this gives enough information, thank you.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You can start here - msdn.microsoft.com/.../gg328263.aspx

    Do you have any specific questions?

    One tip you should know - register your plugin without isolation because otherwise you will not have an access to file system.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    As Andrew specified you can write a plugin (or possibly need an Action if this depending on how you are supposed to execute this process).

    Create the Plugin

    Within the plugin add code to create the Xml file and upload it or store it to the location where you need. Most of this will be general C# programming.

    If you are using CRM Online, this logic might be somewhat different, since Plugins on CRM online run in isolated mode, so there is some functionality that cannot be achieved the same way as if it is running On-Premise.

  • Community Member Profile Picture
    on at

    Thank you guys for your replies. I have one more question, how would I generate an xml file and save it to a server location? xml serializer and stream writer won't allow me for insufficient permissions.

    Thank you again

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Christian,

    If you are unable to use XmlWriter or Stream Writer, you can probably use XDocument or XmlDocument to generate your file

    XDocument: msdn.microsoft.com/.../system.xml.linq.xdocument.aspx

    XmlDocument: msdn.microsoft.com/.../system.xml.xmldocument.aspx

    There should be plenty of samples on creating these two.

    You can use either of the following ways to save the file to your server.

    XmlDocument xdoc = new XmlDocument();

    xdoc.LoadXml(xmlString);

    xdoc.Save("PATH\xmlFile.xml");

    File.WriteAllText("PATH\xmlFile.xml",xmlString);

    Good luck.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Hi Christian,

     since you are working with Dynamics Online(it seems), you'll actually have to store that file somewhere else - I don't think you can store it directly on the server (which is a MS-provided server dedicated to Dynamics. You would not have local permissions there)

     If you need to pass it to another plugin later, attach that file as a note to an entity (maybe create a custom entity just for that)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans