Auxiliary Force

Dynamics CRM Clone A Record With JavaScript

A very common request we often get is to have a clone record button added to an Entity. The JavaScript code tends to be the bigger issue than adding the ribbon button so to keep this post clean and direct the following code with cycle through every Field (unless one is excluded) to create a new record, ready for review, that can be saved as a clone. Continue reading

Setup Dynamics CRM E-mail Router with Office 365

Setting up the Dynamics CRM E-mail Router can be a bit tricky considering access rights to the Office 365 accounts. The long story short is that one account must be designated as the account through which all E-mail will pass. This means that account must have something called “Send As” privileges to the other Office 365 E-mail accounts. You can also use an access type called “Send On Behalf Of” but the difference lies in what the recipient sees:

If “Send As” is the method then the recipient just sees a normal E-mail address:

If the “Send On Behalf Of” is the method then the recipient sees the routing account with a message that it is sent on behalf of: “Sent on Behalf of:”

As such, most people prefer to use the “Send As” option. This is how you setup a routing account with “Send As” privileges.

Continue reading

Open New Dynamics CRM Record with Pre-Populated Fields

A very common JavaScript customization is to open another Entity with pre-populated Fields from the original Entity. This is achieved using the “openEntityForm” method provided by the Microsoft SDK. In the example below, this code could be triggered from the Opportunity to open a Phone Activity that populates the “Name,” “Regarding,” and “Regarding Type” from the Opportunity.

var lookupItems = {};

lookupItems["parameter_regardingname"] = Xrm.Page.getAttribute("name").getValue();
lookupItems["parameter_regardingid"] =;
lookupItems["parameter_regardingtype"] = "opportunity";

Xrm.Utility.openEntityForm("phonecall", null, lookupItems);

How To Set A DD-WRT Router As A Repeater Access Point

While not specifically Microsoft Dynamics CRM, I had a client ask how to set up a repeater at their office using leftover modems and using DD-WRT immediately came to mind as an ideal solution. The below instructions show how to re-purpose routers in such a manner so as to extend, and secure, a network.

Continue reading

Dynamics CRM JavaScript Code Basics (xRM 101)

Dynamics CRM JavaScript programming is actually far easier than most people would believe with so much code being re-used so frequently. While an exact percent would be impossible to achieve, it could be said that probably 80% of the code anyone will need for JavaScript Form customization can be can found in the following list.

With the advent of Business Rules in Dynamics 2013 many have come to erroneously conclude that JavaScript customization falls into either a “too complicated for the average Administrator” or “too basic that a Business Rule should be used instead.” Unfortunately, along with the advent of Business Rules came the advent of Business Rule frustrations such as:

Seemingly random order-of-operations.

Failing Business Rules that “should work.” and,

Business Rules that result in side-effect problems (try hiding Tabs with a non-Field element like a Quick View or Web Resource).

As such, having this arsenal of JavaScript commands will more successfully (and more efficiently enable the customization you need), enjoy!
Get Attribute Value
var variable = Xrm.Page.getAttribute("attributename").getValue();
Set Attribute Value
Set Visibility

Make Attribute Required

Show/Hide Section

Show/Hide Tab

Get Lookup Value
var lookup = new Array();
lookup = Xrm.Page.getAttribute("attributename").getValue();
if (lookup != null) {
var name = lookup[0].name;
var id = lookup[0].id;
var entityType = lookup[0].entityType;

Set Lookup Value
var lookup = new Array();
lookup[0] = new Object();
lookup[0].id = recorid;
lookup[0].name = recordname;
lookup[0].entityType = entityname;
lookup[0].type = "lookup";


Xrm.Page.getAttribute("attributename").setValue([{ id: recorid, name: recordname, entityType: entityname, type: "lookup"}]);
Add Days, Years, etc. and Find Date/Day Information
function addSevenDays()
var originalDate = Xrm.Page.getAttribute("attributename").getValue();
newDate = new Date(originalDate.getFullYear(), originalDate.getMonth(), originalDate.getDate() + 7);