
This is the code I modified for a web resource that reads the LinkedIn Company Profile number from a custom field in Dynamics CRM. I used this to load the profile badge onto the account form.
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script src="https://platform.linkedin.com/in.js" type="text/javascript"></script>
<meta charset="utf-8">
</head>
<body style="word-wrap: break-word;">
<script type="text/jscript">
try {
// Retrieve the profile id from Dynamics CRM
var linkedprofilelink = window.parent.Xrm.Page.getAttribute("mge_linkedin").getValue();
if (linkedprofilelink != null) {
// Load the profile including url prefix for company
newcompanyprofile("http://www.linkedin.com/company/" + linkedprofilelink);
}
}
catch (e) {
alert(e.message);
}
function newcompanyprofile(id) {
// Create the script tag
var $s = $('<script/>');
// Assign the attributes
$s.attr({
'type': 'IN/CompanyProfile',
'data-id': id,
'data-related': 'false',
'data-format': 'inline',
'data-width': '350px'
});
// Inject the tag
$('body').append($s);
}
</script>
</body>
</html>
*This post is locked for comments
I have the same question (0)Replace custom field 'mge_linkedin' with your own custom field name. Insert the web resource into your form and away you go. The custom filed should contain the company profile id number.