| Daren's profileDaren TurnerBlogLists | Help |
Books about Microsoft CRM
Books I read when I'm not working
|
Daren TurnerDT December 15 How to pull entity information from the Microsoft CRM MetaData Service using javascript.
The following code will pull entity information, using the Metadata service, using javascript. This code is useful for pulling the objecttypecode dynamically when they may differ between environments. var _sWebServicesNamespace = "http://schemas.microsoft.com/crm/2006/WebServices"; function _RemoteMetaCommand(sCommand, sAction) var soapmessage = "<?xml version='1.0' encoding='utf-8'?>" return xmlhttp.responseXML; var entity = "new_country" //Get ObjectTypeCode var result = _RemoteMetaCommand(query, "RetrieveEntityMetadata").selectSingleNode("//ObjectTypeCode"); var countryentitytypecode = result.text;
Here is the response. July 07 Auditing for CRM 4.0This is a plugin that I developed to audit transactions in CRM 4.0. The records that are created are stored in CRM and can be related to the entities in CRM. Features
Messages Tested
Download Here
This customization may not be supported by Microsoft and is provided as-is with no warranty. December 12 How to change the entity drop down for the Customer LookupIn this post, I'm going to show you how to modify the entity drop down for the Customer Lookup without changing the security for the whole application. I'm going to use the customer lookup for opportunity as our example. By default you have Account and Contact in the drop down for the 'Look For:' search criteria. If you look at the html for the customer lookup field, on the opportunity form, it looks like this. <img src="/_imgs/btn_off_lookup.gif" id="customerid" class="lu" tabindex="1010" lookuptypes="1,2" lookuptypenames="account:1,contact:2" lookuptypeIcons="/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif" lookupclass="BasicCustomer" lookupbrowse="0" lookupstyle="single" defaulttype="0" req="2"> The 3 attributes we will need to change is lookuptypes,lookuptypeNames and lookuptypeIcons. Reorder the Dropdown To reorder the drop down, add the following code to the 'OnLoad' of the Opportunity form. crmForm.all.customerid.lookuptypes = "2,1" The dropdown should default to Contact when it's opened.
Remove an Entity from Dropdown To remove Contact from the customer lookup for Opportunity add the following code on the 'OnLoad' of opportunity. crmForm.all.customerid.lookuptypes = "1" The lookup should only be for accounts.
Although it may be possible, I wouldn't add entities to the lookups since the customer relationship does not exist.
This customization may not be supported by Microsoft and is provided as-is with no warranty. March 29 Viewing a Logo in Microsoft CRMI'm always getting the question on how to view a logo or image in Microsoft CRM. Well here is a quick customization you can add to your account form and view a logo. Once you add this script on the 'OnLoad' event of the form, all you need to do is add an image called 'logo.jpg' as an attachment and everything will show up properly. This customization will even work offline. Script var Loaded = false; if(crmForm.FormType ==2 || crmForm.FormType ==3 || crmForm.FormType ==4) // attach an event so we know when the notecontrol is done loading // refresh the notecontrol function LoadLogo() var oDoc = (oNotes.contentWindow || oNotes.contentDocument); //Iterate through all the attachments. When your done, your form should look like this. If you really want to get creative you can go a little further and build a viewer to page through all images that are attached to the record.
This customization may not be supported by Microsoft and is provided as-is with no warranty. March 28 Replicating CRM Records to another CRM SystemA friend of mine called me up and asked if it was possible to create records in one CRM system when they are created in another one. Well here is a quick example of how to do it. Assumptions
If there are discrepencies with the guids in each system, there will be issues with this example. When the postImageEntityXml is Deserialized into a DynamicEntity, it has the guid of the source system. When it's created in the target system, it's created with the same guid. For this example I will show you a simple Post Callout to replicate a Create action, but I recommend sending these transactions to a Message Queue and then processing them from there. It's also not only limited to Create, the same thing can be done for other actions. Code public override void PostCreate(CalloutUserContext userContext, CalloutEntityContext entityContext, string postImageEntityXml) //build the credentials for access if the current user doesn't have access. DynamicEntity entity = (DynamicEntity)Serialization.DeserializeBusinessEntity(postImageEntityXml); TargetCreateDynamic targetCreate = new TargetCreateDynamic(); CreateRequest request = new CreateRequest(); request.Target = targetCreate; CRMSDK.CreateResponse response = (CRMSDK.CreateResponse) service.Execute(request); return entity; This code isn't entity specific so it will work for most of the entities in CRM. All the entity information is in the postImageEntityXml and is Deserialized into the DynamicEntity. Callout Registration <callout entity="account" event="PostCreate"> <callout entity="contact" event="PostCreate"> There are a lot more things you can do to improve this process. This is just a simple example. Some other things to consider adding into your solution is Message Queueing and Exception Handling. Hope this helps. A big shout out to Henry who is out in Ohio this week :).
This customization may not be supported by Microsoft and is provided as-is with no warranty. |
||||||||||||
|
|