CRM 2013 - C# Plugin - Open a SaveDialog RRS feed

  • Question

  • Hi

    I'm currently developing a plugin that when a user creates a new account the details in the fields are exported to a .csv file

    I would like to let the user choose where the csv file is saved too.

    I inputted the following code;

    SaveFileDialogsaveFileDialog1 = newSaveFileDialog();

    saveFileDialog1.Filter =

    "CSV File |*.csv";

    saveFileDialog1.Title =

    "Choose Where To Save The CSV File"


    But got the following error when testing;

    "Showing a model dialog box of form when the application is not running in UserInteractive mode is not a valid operation. Specify the serviceNotificaition or DefaultDesktopOnly stule to a display to notification form a service applicaiton

    Any ideas what to do?

    Thanks, Shaun


    Monday, June 9, 2014 10:25 AM

All replies

  • Hi Shaun,

    CRM Plugins are essentially assemblies that cannot have any UI. Even if you add the required assemblies and "SaveDialog" control, that wont be allowed. You need to probably think of some other alternative method.

    Alternative methods:

    a. You could store the .csv files in a fixed path.

    b. You could ask the user to provide the path in the Account form so the .csv is saved in that path. (not the best thing to do)

    c. You could ask the user to save the record and then export it in a .csv format.

    Admin QuikView Solution for CRM 2013

    Monday, June 9, 2014 10:50 AM
  • Shaun ,

    You can not open a dialog from plugin. You can set a flag in your plugin to a field than after your form is loaded you can check this flag and open the dialog from javascript.

    Polat Aydın Crm Software Developer

    Monday, June 9, 2014 10:52 AM