Friday, 14 November 2014

Automatically populating Order address fields using customisations

17:58 Posted by Benitez Here , ,

Sometimes I have a "I wish" moment with Microsoft Dynamics CRM. If I had a lamp where a genie came out and granted me wishes, it would probably be depleted in a short amount of time. There are some things Microsoft Dynamics CRM could have out-of-the-box but I also have to remind myself that it's a system to be utilized across a whole Organisation so it does somewhat make sense when there are certain things that are not "standard" as it may not be relevant for all Business End Users.

Anyhoo... one thing that gets raised ocassionally is the address fields on the Order entity. When you create an Order, the address fields remain blank. The address fields aren't automatically populated.

Have no fear citizens, address fields on the Order can be achieved using customisations. Checkout my vlog.

Method 1 - Entity and attribute mapping

Field mapping is a handy dandy trick in Microsoft Dynamics CRM. You can map fields from one entity to another to help make creating and populating records more efficient. In this case, map the fields from the Contact address fields to the Order address fields. You do need to be aware of some of the limitations. I mentioned some of them but you can find the full stack - 
This method is applicable if you are creating the Order from the Order Associated View of the Contact or Account record.

Method 2 - Custom fields, real time workflows and business rules

Sooo... if you don't want to create an Order from the Order Associated View of the Contact or Account, you can stick with this method. 1. Create two fields on the Order, Copy Contact Address and Copy Account Address. Add these two fields on the Order form. I chose to create these fields because of how the Potential Customer field on the Order is a lookup field. It only allows you to select Contact or Account. In a workflow, I wasn't able to set this condition as it's a lookup field pointing to an entity type (unless you have a suggestion?). So my way around this is creating two custom fields.
2. Add the Address fields on the Order. I didn't use the Composite address field as most customers I have worked with usually want to see all of the address fields in the Order instead of the CRM 2013 Composite style. 3. Create two real time workflows where it will set the address fields in the Order from the Contact or Account address fields.
4. Too make it more tidier, I created two Business Rules to prevent Copy Contact Address and Copy Account Address field being selected at the same time. I only want one of these fields to be selected since you can only choose a Contact or an Account for a Customer on the Order.

Now when you create an Order, just select either of the custom fields to copy the address from the Contact or Account.

Super, now you know to use customisations to help you out. Before you go ahead with these methods, please do make sure you do add the address fields on your Contact or Account record. I used Address 1 for Physical and Address 2 for Shipping.
Give it a go :)

You can apply this for Invoices as well. Either map the address fields from the Order to the Invoice, or go with Method 2 if you aren't creating Invoices directly from the Contact or Account.

Thanks for tuning in. Toodles.