#CodeNow for #XrmToolBox–set fetchxml for a system view

By | November 12, 2017

There are other ways of doing this, but here is how you can use CodeNow plugin for XrmToolBox to update FetchXml for a system view (you will need, at the minimum, v1.0.0.18 of the CodeNow plugin)

Load CodeNow plugin (if it’s not installed yet, go to the plugin store in XrmToolBox and install the plugin first)

image

Make sure XrmToolBox is connected to Dynamics:

image

Click File->Open

image

And select “Online” storage from the list:

image

Then select “Set View Fetch” script

image

If you run the script right away, it will run for the account entity. You can change the entity name if you wish:

image

Then click “Run”

image

The script will ask you to choose a view

image

And, then, to provide updated fetchXml for that view:

image

Once you have provided updated fetchXml and hit “ok”, the script will go on to update fetchXml for that view, and, also, to publish all customizations. At which point you will be able to see the results of that update in Dynamics.

 

By the way, this script also demonstrates a couple of new features that’s been added to the CodeNow:

1. CodeNow script can ask users to choose one of the options from a dropdown now:
string selectedView = Helpers.GetSelection(“Select a view”, “View Fetch Updater”, viewOptions);

2.CodeNow scripts can ask users to provide text input now:

string newFetch = Helpers.GetTextInput(“Enter FetchXml”, “View Fetch Updater”);

This allows for a bit more interaction and a bit less coding, so the same scripts can be re-used by non developers even easier.

Leave a Reply

Your email address will not be published. Required fields are marked *