Thursday, February 14, 2008

Generate MS CRM Entity Schema.


Hi,
"GenerateEntitySchema" tool generates a MS CRM Entity Schema.
Example "account": it generates the schema for all the attributes including (picklist values).
Have a look at this tool. (See screenshot)





you can download Generate MS CRM Entity Schema from http://www.codeplex.com/GenerateEntitySchema

As I'm working on this tool i'll release the source code soon.

All feedbacks are most welcome. !!!


Happy MS CRM Development.

Monday, February 4, 2008

Microsoft Dynamics CRM Demonstration Tools (for Microsoft Dynamics CRM 4.0)


Brief Description
The Microsoft Dynamics CRM 4.0 Demonstration Tools provide a simple user interface that allows you to easily enter and edit data to populate or modify your instance of Microsoft Dynamics CRM. It also allows you to load and store your data in XML format, so that you can reuse your data in the future.

You can download this tool from Microsoft website, for more information
Visit: http://www.microsoft.com/downloads/details.aspx?FamilyID=634508DC-1762-40D6-B745-B3BDE05D7012&displaylang=en

Sunday, February 3, 2008

MS CRM 4.0 Plugins not working


If you are working with the default Plugin sample which is shipped with MS CRM 4.0 SDK, unforunately if it doesn't work then simple regenerate the Strong Name Key (snk).

Steps:
1. Open the Sample Plugin Solution.
2. Right Click on the Solution -> Properties.
3. Click on "Signing" Tab (look at Left Navigation Bar).
4. Select "New" from "Strong name key file dropdown"
Enter "SamplePluginKey" in Name text box
uncheck "Protect my key file with a password"
Click on "OK"
Click on "Yes" which it asks for replacing the existing strong name key file.
5. Save All Files.
6. Compile the Solution.


Here you are all set to go :)
Isn't it simple ?

Comments are most welcome !!!!!!!!

Generate postImageEntityXml (MSCRM 3.0) equivalent in MS CRM 4.0 Plugins


If you worked on MS CRM 3.0 callouts, in the method signature of Pre/Post you get a string called as postImageEntityXml.

postImageEntityXml is nothing but an XML string that describes the entity after the assign operation was performed. This is a serialized version of DynamicEntity.

You can create the DynamicEntity Object using the Context Object.
Eg:
DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"];

Below is the code for MS CRM 4.0 which is equivalent of the postImageEntityXml string value in 3.0.

To implement this code functionality in plugin, use the Sample Plugin Code:
------------------------------------------------------------------------
public class postImageEntityXmlExample : IPlugin
{

// This fucntion gets called from the EXECUTE method of plugin (marked in bold)

private string SerializeDynamicEntity(Microsoft.Crm.Sdk.DynamicEntity entity)
{
XmlSerializer serializer = new XmlSerializer(typeof(Microsoft.Crm.Sdk.DynamicEntity));
StringWriter writer = new StringWriter(CultureInfo.InvariantCulture);
serializer.Serialize(writer, entity);
return writer.ToString();
}


private void WriteToFile(string message)
{
try
{
StreamWriter sw = new StreamWriter(@"c:\ErrorLog.txt", true);
sw.WriteLine();
sw.WriteLine(System.DateTime.Now.ToString());
sw.WriteLine();
sw.WriteLine(message);
//Cleanup
sw.Close();
}
catch (Exception ex)
{
//TODO Develop Code, if an Error comes while write to File
}
}

public void Execute(IPluginExecutionContext context)
{
DynamicEntity entity = null;

if (context.MessageName=="Create" context.MessageName == "Update")
{
if (context.InputParameters.Properties.Contains("Target") &&
context.InputParameters.Properties["Target"] is DynamicEntity)
{
entity = (DynamicEntity)context.InputParameters.Properties["Target"];

//call the below code to Serialize Dynamic Entity into postImageEntityXml
WriteToFile("\XML string \n" + SerializeDynamicEntity(entity));
}
}
}
}

---------------------------------------------------------------------------

Isn't it simple?
Happy MS CRM Development.

Comments are welcome..... :)