Basic Facts & Introduction to Auto Save feature in Microsoft Dynamics CRM 2013 #MSDynCRM #CRM2013

This post tries to list everything essential you need to know about the Auto Save functionality in the upcoming Microsoft Dynamics CRM 2013. This is followed by another post about how to disable this functionality for the whole Dynamics CRM 2013 organisation or disable auto save on specific entity forms.

Here are the facts:

  • Auto Save is automatically triggered every 30 seconds (approx.) on all forms in Dynamics CRM 2013.
  • There is no more “Save” on the top left of a Dynamics CRM 2013 form as it was in the previous version, CRM 2011. The save button now is a small icon at the bottom right corner of your form.
  • Auto Save will trigger all your plugins and workflows that are set to run on updating the form.
  • If another user is editing the same Dynamics CRM 2013 form, their updates will show on your form once auto save occurs.
  • Actively edited fields are not updated.
  • Auto Save can be disabled at organisation level (not recommended) from system settings –> General Tab –> Disable Auto Save.
  • Once Auto Save is disabled for the whole organisation, the “Save” button then appears on Dynamics CRM 2013 forms as shown in the following screenshot:
Save Button shows when Auto Save is Disabled at Organisation level
Save Button shows when Auto Save is Disabled at Organisation level
  • Whether auto save is enabled or disabled, if you navigate away or close a Dynamics CRM form or even if you click on back on your Dynamics CRM web client (Browser), you will still have all your changes saved. Previously in Dynamics CRM 2011, you used to get a warning message that you are navigating away and you will lose all your data. Now, if you navigate away, everything is saved for you. Please note this functionality is irrelevant of auto save being enabled or disabled. It will happen in all cases even if auto save is disabled for the whole organisation.
  • Generally, as a best practice, make sure that your plugins fire on specific field updates and not on general updates of the form. This will avoid full execution of a plugin when a field is updated that is different to the desired one.
  • As explained before, you can disable AutoSave feature at organisational level from system settings for all entities, you can also disable auto save for named specific forms for specific entities using a simple JavaScript library that you add to your form and call from the onSave event of the form. This is described in details in this post:

http://www.mohamedibrahim.net/blog/2013/09/29/disabling-microsoft-dynamics-crm-2013-auto-save-feature-for-a-specific-entity-form-or-a-crm-organisation-to-avoid-undersired-execution-of-plugins-or-workflows/

 

Disabling Microsoft Dynamics CRM 2013 Auto Save feature for a specific entity form or a CRM organisation to avoid undesired execution of plugins or workflows

Microsoft Dynamics CRM 2013 comes with a new auto-save feature which triggers a save action on forms every 30 seconds (approx.). So if you are editing a form, an autosave is triggered automatically by CRM 2013 on regular intervals. This feature means that if you have a plugin or a workflow that first on saving the form, it will be triggered every time the auto save action is fired. This will obviously cause undesirable actions and potentially unexpected consequences to several processes especially in the case of an upgrade from Dynamics CRM 2011 to Dynamics CRM 2013.

To disable the Auto Save feature in Dynamics CRM 2013, you can stop it at organisation level which means NONE of your entity forms will have auto save across both customisable (System) and custom entities and their forms. To do this in Dynamics CRM 2013, you need to go Settings –> System Settings –> General Tab (first tab) –> Enable Auto Save on All forms –> No.

This is shown in the screenshot below:

Enable Disable Auto Save
Enable/Disable Auto Save feature in Microsoft Dynamics CRM 2013

 

Alternatively, if you want to allow Auto Save to work on some entities but not on others, you can write a small JavaScript web resource which can disable auto save on specific forms of your choice. This web resource JScript library can be enabled on selected forms of your choice.

To do this, you can call “GetSaveMode()” in client SDK to detect the auto-save. You can then call “preventDefault()” to write to the server to prevent the save. Here is the full script:

function preventAutoSave(econtext) {
 var eventArgs = econtext.getEventArgs();
 if (eventArgs.getSaveMove() == 70) {
 eventArgs.preventDefault(); 
 }
}

So here are the steps:

  1. Add the above function “preventAutoSave” as a web resource to your Dynamics CRM JavaScript library. Then,
  2. Add this JScript library to the form libraries of the form you want to disable Auto Save on.
  3. You should then register the function on the onSave event on this form you selected. Make sure you select the option to “pass execution context as the first parameter”.

This will stop auto save from triggering on this form. Repeat the same steps above for any form you wish to disable Auto-Save for.

For more information about Auto Save feature in Microsoft Dynamics CRM 2013 please check my other post which provides introduction to Auto Save functionality in #CRM2013 :

http://www.mohamedibrahim.net/blog/2013/09/29/basic-facts-introduction-to-auto-save-feature-in-microsoft-dynamics-crm-2013-msdyncrm-crm2013/

 

How to setup & configure your Hyper-V guest virtual machines to connect to the Internet & to your host windows 8 Laptop or server 2012 to share folders (External & Internal virtual switches)

Building development and presentation or demo Virtual Machines on Windows 8 professional laptops or desktops and using Microsoft Hyper V is now fairly common. Hyper V server is now available to work on Windows 8 professional which was previously only possible on Windows Server 20012 (and 2008). We used to have to build our laptops on windows server 2012 operating system due to this limitation previously but now it is very common to have hyper-v running on Pre-Sales Consultants and Architects laptops (and even tablets such as Surface now).

A common challenge/issue with the setup of Hyper-V Virtual Machines is the internal and external networking of the virtual machine and how you can get your Virtual Machine to work internally within your LAN so that it can connect to your host machine (Laptop or Desktop PC) and so that it can also have external Internet Connectivity. This also applies to setting up your Hyper-V server using Windows Server 2012 so that its guest virtual machines and the host server are all connected to one network and all have external connection to the Internet.

This topic has probably covered by many before but I still found that some people are stills struggling with it, hence I decided to write this post. I’ll try to make the post clear and focused in the form of bullet points to be an easy guide for anyone trying to setup the network adaptors on their Virtual Machines.

First thing you need to know is that I strongly recommend that you have two network adaptors in your Virtual Machine (VM): Internal and External adaptors. Similarly, you need to have two virtual switches created in your Virtual Switch Manager in Hyper-V: Internal Switch and External Switch to be used by the two virtual adaptors in your Virtual Machine.

Internal Adaptor will allow for the Virtual Machine to be accessible from within your host machine so that you can Remote Desktop (RDP) to your Virtual Machine using this internal linkage between your host (laptop or PC) and the VM. You also need this internal connection for sharing folders between the host and the virtual machine and to map network drives between them.

The External Adapter is required to allow for your Virtual Machine to be able to connect to the Internet through the host machine physical network card (NIC) (via the external switch).

Each virtual Adapter on a virtual machine requires a virtual Switch to be created on Hyper-V server.

So, firstly, you need an Internal Virtual Switch to get your internal VM adapter to use the host physical NIC (Network Card). Screenshot of how your virtual switch (internal) can be configured is below:

Virtual Internal Switch
Virtual Internal Switch

For this Internal connection, I suggest that you specify a static IP address for your Virtual Machine’s internal virtual adapter and your host’s internal adapter. This is to ensure that any shares between host and VM and the RDP connection have constant connection based on this IP. The IP address I used was for example: 192.168.2.20 and 192.168.2.21 for host & VM respectively with the VM’s default gateway equals to the Host IP (192.168.2.20).

You will then need an external virtual switch. When you create a new external virtual switch, the switch takes over from your physical host machine network card (NIC) and your NIC becomes just bridged to this external switch. Similarly, your Virtual Machines Adaptor will just connect to this virtual switch (external) and will then have the VM connected to the Internet. The external switch can be setup to connect to Ethernet or Wifi. I have chosen to make it to work with Ethernet. You can have another one for Wireless connection if you prefer. Screen shot of external virtual switch configuration is below:

Virtual External Switch
Virtual External Switch

When creating the external virtual switch please make sure that the option to: “Allow operating system to share the external switch” is ticked to allow for the Operating system to get the physical NIC of the host to connect to the internet via the external virtual switch.

Let’s say you have an Internet Router at home and you have done the above setup for the external virtual switch and virtual adapter in the VM, you will find that your external switch will take an IP address from this Router, your host machine will have a different IP as if it is a different device and your Virtual Machine’s external adapter will have another IP from the router. So 3 different IPs. I suggest that you keep these IP’s dynamic especially if this setup is on a your laptop or demo machine. The reason is that you must be connecting to different Internet connections via different routers and switches which each will give you a different IP for your virtual external switch. In this case, if your IPs are static, then every time you connect to a new Internet router, you need to change the IPs of all 3. If they are dynamic, then you do not need to do anything.

This means that your VM can be accessible internally from the host machine using this IP and this internal network via the router. You might here say then we do not need an internal virtual switch as the external one is enough. This is only true as long as you got your virtual switch connected to the If you disconnect your external virtual switch from the router, then you will not be able to access your VM from the host as the VM will lose this IP address and if you decide to use static IP addresses for this external connection, you will find that every time you go from home to office, you need to change IP addresses of the external adapters.

Hence, and for all of the above reasons, I strongly suggest that you have an internal virtual switch for permanent connection between your host and virtual machine… and an external virtual switch for Internet connection for both your VM and your host machine (Laptop/PC/Server).

Notes:

  • Please note that after creating the Virtual External Switch, the switch takes over the connection so you might need to restart your host machine.
  • Once restarted and as long as the option to allow operating system to share the external switch is ticked as mentioned before, then the host will get connected to the Internet as well.
  • If you started the Virtual Machine while the host is not connected to the Internet, you may need to renew the VM’s external adapter IP address. Either Disable & then Enable the VM’s external adapter if you want to renew the IP or simply run the renew IP command in a command prompt on the virtual machine. This is the case when you have a dynamic IP address on the VM’s external adapter.
  • Make sure you choose meaningful names for your virtual switches both external and internal and for your Virtual Machine virtual adapters.
  • Below is a screen shot of how my host machine (Windows 8 Laptop) has its network adapters named:
    Host Machine Network Adapters
    Host Machine Network Adapters

    Hyper-V names all virtual network adapters with vEthernet and then the name of the virtual switch between brackets. So you will find in the snapshot above that:
    vEthernet (Virtual External Switch) connects to my Hyper V Virtual External Switch and the other one for the Virtual Internal Switch.

  • Below is a screen shot of how the virtual machine network connection adapters look:

    Guest Virtual Machine Network Adapters
    Guest Virtual Machine Network Adapters
  • I also found the following post and video helpful:

http://www.eightforums.com/tutorials/19359-hyper-v-virtual-switch-manager.html
http://www.youtube.com/watch?v=-IoZJYQeq4U