(this post was contributed by Brian Barnett, Senior Software Engineer on the MDS Team)
While using Bing Maps
last night to look for directions I thought of a way to use MDS business rules to create a Bing Map URL link attribute. This may sound like merely a cool thing to try but not very useful. But, I’m going to show a couple of examples of how it could be useful to pique your interest for other possibilities.
Here is the URL format we will need to follow to open Bing Maps to a specific address:
For more info see the Bing Maps help topic Build your own URL.
I’m going to use the Customer sample model. We’ll need to add a link attribute to the customer entity then create a concatenation business rule to set the value of the link attribute. In this post I’m not giving the step-by-step, detailed instructions to create each item. Please see my Creating a Simple Business Rule and Enabling Human Workflow – Part 1 posts for specific instructions.
Add the link attribute
Add a new Free-form, link attribute to the Customer entity called BingMapURL. Make sure the data type is Link.
Create the business rule
Now let’s create a rule to populate its value.
- Create a new rule and then navigate to the Business Rules Designer page.
- In the Components pane, expand the Actions and Change value nodes.
- Click the “equals a concatenated value” action and drag it to the THEN pane's Action label.
- In the Entity-Specific Attributes pane, click the BingMapURL attribute and drag it to the Edit Action pane's Select attribute label.
- In the Entity-Specific Attributes pane, click and drag the following attributes to the “Value” node of the “equals a concatenated value” action.
- At this point your Edit Action should look like this
Now let’s add the Bing Map specific URL pieces.
- Right click on AddressLine1 attribute and select “Insert text” from the context menu.
- Double click the new line and enter this text, without the quotes, “http://bing.com/maps/default.aspx?where1=”.
- Right click on the City attribute and select “Insert text” from the context menu.
- Double click the new line and enter this text, without the quotes, “%20”.
- Repeat steps 3 and 4 for the StateProvince and PostalCode attributes.
- Now your Edit Action should look like this.
- In the Edit Action pane, click Save. The action will be displayed.
- Click Back to return to the Business Rule Maintenance page.
- Optionally, on the Business Rules Maintenance page, for the row that contains your business rule, double-click a cell in the Name and Description columns to update the value.
- Click Publish Business Rules
- On the confirmation dialog box, click OK. The rule’s status will change to Active.
Try it out
Add a new customer then return to the Member grid. Scroll over to the right and you will see the populated BingMapURL.
Double click the link icon and then select View from the context menu.
A new browser window opens to the Bing Maps URL.
To prevent users from editing the BingMapURL attribute change the security permissions to Readonly. Other possibilities are to create another link attribute called BingMapDirectionsURL which would be the URL for directions from your company to the customer.
Here’s another example, which I’ll not walk through but simply give you as an idea. What if you have an internal (or external) product catalog website? If you are managing Product data in MDS then you can add a ProductCatalogURL link attribute to the Product entity then follow the same steps we did with the BingMapURL to create it. The link would be the URL to jump to that product in the catalog.
If you want to take this a little further you could create an ASP.Net web application that utilizes the MDS API. You could create a product list page listing all the products. Each product listing would have a link to the product catalog using the ProductCatalogURL.
There are a lot of possibilities. All it takes is a little creativity.