In this recipe, we will have a quick look at leveraging a tagging site such as Del.icio.us to determine the popularity of an account. If you intend to use this in a production environment I would suggest relying on a combination of multiple sources. Take this result with a grain of salt, unless your business revolves around this. This example is only to show you how you can get data from Del.icio.us and use it within Dynamics CRM. You can expand on this example and retrieve the actual tags of a specific account or any other information stored on Del.icio.us.
The updated URL now for Del.icio.us is www.delicious.com, but for most of us who have used it since the inception, del.icio.us still rings the bell.
For this recipe you will need the jQuery library. Head over to http://jquery.com/ and grab the latest version from there.
Make sure you have the system customizer or system administrator permission in the environment you will be developing in.
You can re-use a previously created solution package, or create a new one.
As previously described in other recipes, you will need the jQuery library. Assuming you have downloaded it already, perform the following steps:
jQuery
and load the jQuery library.Del.icio.us index
(new_popularity
).new_delicious
.function getDelicious() { var _deliciousURL = Xrm.Page.getAttribute("websiteurl").getValue(); if(_deliciousURL != null && _deliciousURL != "") { $.ajax({ type: "GET", dataType: "json", url: "http://feeds.delicious.com/v2/json/urlinfo/data?url="+_deliciousURL+"&callback=?", success: function(data){ var count = 0; if (data.length > 0) { count = data[0].total_posts; } Xrm.Page.getAttribute("new_popularity").setValue(count.tString()); } }); } }
We are calling our function in two places in this example, to make sure we bring an updated bookmark count every time the URL changes or when a user opens an existing account.
Our function queries the Del.icio.us API and retrieves the total number of bookmarks for the specified URL. We are using jQuery Ajax for the call.
Using a similar approach, you can query for additional information from Del.icio.us. You might want to query specific tags or even all the posts of an account or contact if they have an account on that system.
3.149.229.19