Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Capitalizing on Microsoft Dynamics CRM 3.0 Callouts: Introduction to Callouts : Page 3

Add value to your CRM system by firing customized actions in response to CRM events.


advertisement
How the Callout Works
Here is what the PostUpdate callout method does. Whenever a lead record's status is changed, it fires the PostUpdate method, which serializes the postImageEntityXml to a dynamic entity and calls the ProcessLeads method if the name of the entity is lead. The ProcessLeads method writes the postImageEntityXml to a text file. To run the application, follow these steps.
  1. Launch the CRM browser and navigate to the Sales tab.
  2. Click on Leads, and then click on New.
  3. Enter the first name, last name, and country, and then click on Save, and finally, Close.
  4. Double-click on the newly created record to open it in edit mode.
  5. Change the status from "New" to something else.
  6. Open the text file whose name begins with "Crmcallout" on the C:\ drive.
  7. Compare the values in the text file with the newly updated record in the CRM (see Figure 1).
 
Figure 1. Updated Record: Your newly updated record should look similar to this one.

Some important points that you should note while developing a callout are:

  1. You should not access System.Console or use Pinvoke in the callout code.
  2. Make sure that you don't update the entity itself in its post-callout; doing so will cause a deadlock. If you must do that, put the required code in place to avoid deadlocks.
  3. MSCRM callouts do not call Dispose methods; therefore, you should write your code so it explicitly releases resources.
Deploying Callout Assemblies
When you finished developing the assembly, place it in the C:\Program Files\Microsoft CRM\server\bin\assembly folder. Note that you don't need to deploy the Microsoft.Crm.Platform.Callout.Base.dll because it's already installed in the GAC. Finally, restart IIS to force the changes to take effect. If you get an error similar to the one in Figure 2, cycle IIS again.
 
Figure 2. Typical IIS Error: IIS can't copy files when they're in use.

Using MSCRM callouts, you can validate CRUD operations and integrate your CRM application with other applications, such as ERPs, SharePoint Portals, etc. In a nutshell, you've seen how to build a callout assembly that exposes methods triggered when specific corresponding MSCRM events fire. Building the callout assembly is straightforward, but when you finish creating and deploying the assembly, remember to reset IIS before executing the application. The second article in this series delves into some more advanced issues.



Joydip Kanjilal has over 10 years of industry experience with C, C++, Java, C#, VB, VC++, ASP.Net, XML, Design Patterns, UML, etc. He currently works as a senior project leader in a reputable multinational company in Hyderabad, India, and has contributed articles on .NET and related technologies to www.aspalliance.com.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap