Rémi Boigey, Partner Technical Consultant @ Microsoft France, did a great Silverlight application (version 0.1) for Microsoft Dynamics CRM 2011 that we share you today.
Solution Features
Next Features
Installation
Step 1 : Save the CRM solution on your disk - SilverlightHierarchicalRelatedEntity_1_0_0_0_managed.zip
Step 2 : Import the solution – Settings / Solutions / Import
Click on Browse Button and select the solution SilverlightHierarchicalRelatedEntity_1_0_0_0_managed.zip.
Click on next buttons and close the form.
Test the solution
In order to test the solution, We provide you a pre-configuration file for an account inside the solution.
In Settings/Customization/Customizations/Customize the System, select the account entity and edit the main Form.
Edit or add a new section.
Click on Insert tab, and then select Web resource 'Hierarchical Related Entity (Account sample).html'
Save and publish the account form.
Customization
You can reuse and customize this solution for different entities, to do this follow the following steps :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Sample hierarchical Related Entity</title> <style type="text/css"> html, body { height: 100%; overflow: auto; }
body { padding: 0; margin: 0; } #silverlightControlHost { height: 100%; text-align:center; }
</style> <script type="text/javascript" src="gps_scripts/Silverlight.js"></script> <script type="text/javascript" src="gps_scripts/hierarchicalrelatedentity.js"></script> <script type="text/javascript" src="ClientGlobalContext.js.aspx"></script> <script type="text/javascript">
var slConf = '<?xml version="1.0"?>' +
'<hierarchies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
'<hierarchy entity="account" pk="accountid" icon="gps_imgs/ico_account.png" displayField="name" UrlBody="/main.aspx?etc=1" UrlBodyExtra="extraqs=id=" UrlSuffix="pagetype=entityrecord">' +
'<relatedEntity name="activitypointer" pluralName="Activités" pk="activityid" fk="regardingobjectid" displayField="subject|string,ownerid|EntityReference,scheduledstart|System.DateTime,scheduledend|System.DateTime" icon="gps_imgs/ico_activity.png" UrlBody="userdefined/edit.aspx?etc=4212" UrlBodyExtra="id=" UrlSuffix="" />' +
'<relatedEntity name="opportunity" pluralName="Opportunités" pk="opportunityid" fk="customerid" displayField= "name|string,estimatedvalue|Money,estimatedclosedate|System.DateTime,closeprobability|int,ownerid|EntityReference" icon="gps_imgs/ico_opportunity.png" UrlBody="main.aspx?etn=opportunity" UrlBodyExtra="extraqs=id=" UrlSuffix="pagetype=entityrecord" />' +
'<relatedEntity name="contact" pluralName="Contacts" pk="contactid" fk="parentcustomerid" displayField="fullname" icon="gps_imgs/ico_contact.png" UrlBody="main.aspx?etn=contact" UrlBodyExtra="extraqs=id=" UrlSuffix="pagetype=entityrecord" />' +
'<relatedEntity name="account" pluralName="Sous-Comptes" pk="accountid" fk="parentaccountid" displayField="name" icon="gps_imgs/ico_subaccount.png" UrlBody="main.aspx?etn=account" UrlBodyExtra="extraqs=id=" UrlSuffix="pagetype=entityrecord" />' + '</hierarchy>' + '</hierarchies>'; </script>
</head>
<body> <form id="form1" runat="server" style='height:100%'> <div id="silverlightControlHost"> <script type="text/javascript"> createSLObj(silverlightControlHost); </script> </div> </form> </body> </html>
The display is done in JavaScript in the variable named “slConf”. This variable contains data in XML.
Tags
Attributes
For information you can use your own pictures, for that you must import them into the CRM as a web resource.
If there are several attributes, you must use the separator ‘|’ between type and schema name and use a comma to separate different fields
Ex:
UrlBody, UrlBodyExtra ,UrlSuffix : are used to build record url
relatedEntity: represents an entity linked to the current record
This code samples is provided "AS IS" without warranty of any kind. We appreciate any feedbacks, so feel free to contact Remi BOIGEY | remib@microsoft.com
PAF