Form JavaScript Manager

Microsoft Dynamics CRM 4.0 has a nice feature of customizing forms but when comes the time to write JavaScript, the bad time comes: no colored syntax, no formatting, etc.

This tool was created to ease the exportation and importation of individual scripts in files to allow you to use an advanced script editor instead of the customization interface.

The main features are:

  • Script export in individual files
    • The format of file is:
      • <Entityname>_<event>.js when onload/onsave event
      • < Entityname>_<event>_<attributename>.js for attributes script
    • Open files with Visual Studio (if present)
    • Open files with default text editor
    • Script file change detection
    • Script import by selecting specific scripts

Besides this tool, I provide a command line utility that works like the initial application. See below for this command line instructions.

How to use the tool

  1. Define the entity for which you want to export the scripts. You can display a list of available entities by clicking the browsing button (“…”). You can also type in directly the logical names of entities, separated with a comma.
  2. Click on the button “Export scripts” to display the list of entity scripts.
  3. By clicking on a script you can see the script content on the right panel. The checkbox is used to know which scripts will be exported to disk.
  4. To export the scripts to disk, define a target directory and click on the button “Export to disk”. Once the export is done, you can choose to display the tab “Script Import”.
  5. As the tool can be run only to import files, you can specify where to search for script files on the disk. Only files that respect the naming convention are displayed.
  6. Use the contextual menu to access edit/import functions:
    1. Edit with Visual Studio: if Visual Studio is installed on the computer, this action opens the script in the Microsoft code editor.
    2. Edit with default text editor: Uses the default text editor to open the script file
    3. Import script: reload the script file and import it to the CRM server
    4. Import and Publish script: reload the script file, import and published to the CRM Server
  7. The import functions are also available through bottom right buttons.

Command Line Instructions

The command FormJavascriptManagerCommand allows you to automate the export and import of the form scripts

FormJavascriptManager.exe /c <connectionName> /f <folderPath> [/i|/e] [optionalParameters]

Mandatory Parameters:
/c <connectionName> : Name of the connection to use in mscrmtools.config file
/f <folderPath> : Folder where to read and write scripts
/e <entitiesList> : Export the scripts of specified entities in <entitiesList> (with format entity1;entity2;entity3)
/i : Import the scripts located in the specified folder

Optional Parameters:
/p : Publish the customizations (Must be used with /i parameter)
/pwd <password> : Password when using custom or IFD authentication
/l <logFilePath> : Path for the log file

Examples

FormJavascriptManager.exe /c AnIfdConnection /pwd MyPassword /e account;contact;lead /f d:\exportFolder /l d:\logFolder\log.txt

FormJavascriptManager.exe /c OnPremiseConnection /i /p /f d:\importFolder /l d:\logFolder\log.txt

Advertisements

5 Responses to Form JavaScript Manager

  1. Ryan says:

    Hello –
    This is a fantastic tool, really creative solution! I wonder if you have plans to support the CRM Online – Passport authentication protocol? I’d be happy to share sample code and this would really make these tools available for all the CRM deployment options.

  2. mscrmtools says:

    Thank you for the feedback.

    I tried to implement it but it seems to require an extra dll I don’t have.

    If you can send me a sample with required dll, I could try to add this feature.

  3. Ryan says:

    OK, I have this missing dll and plenty of samples, I’ll send you something!

    • Paul says:

      I’m just checking in to see if CRM Online is still on the roadmap. This is a great tool and extending in to CRM Online would be even more valuable. Many thanks!

  4. Thanks for your marvelous posting! I actually enjoyed reading it, you might be a great author.
    I will be sure to bookmark your blog and may come back at some point.
    I want to encourage you to continue your great posts, have a
    nice evening!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: