Tuesday, January 31, 2012

Import MSCRM 4.0 BU to MSCRM2011

Pre-requisite
Make sure you have MSCRM 4.0 installed on the 64 bit operating system.
Make sure you have a fresh installation of MSCRM 2011.
Please take a copy of the out of the box customizations

Steps
Step 1: Logon to the SQL Server of MSCRM 4.0
1. 1 Delete the data in Asynchronous Operation Base
1.2 Back up the organization you want to import.
Step 2: Copy the backup file to the MSCRM2011 server.
Step 3: Import the SQL backup file in to the SQL server for the MSCRM 2011 server.
Step 4: In the deployment manager of the MSCRM 2011 server run the import organization wizard (If you face any issues during the mapping of users kindly rectify those errors and proceed to the next step).
Step 5: Rectify the errors during the system check and click Import.

Monday, January 30, 2012

Get the form values in a XAP web resource

Step by Step guide to upload XAP as a web resource and access CRM form field values.

1. Create a Silverlight project
2. Design the page as below in the MainPage.xaml


3. The TextBox1 name is txtFieldName
4. The TextBox2 name is txtFieldValue
5. The Button name is btnUpdateData
6. In the MainPage.xaml.cs file add the below code into the btnUpdateData_Click.


7. Build and add the XAP as a web resource.
8. You can call this XAP web resource in any entity.
9. To test
a. Specify the schema name of the field in txtFieldName
b. Click the button
c. The txtFieldValue will display the value in the respective field.
10. When a particular field value is null you will get errors. Use exception handling to handle such errors.
11. Use this methodology to get the values from other fields.
This is just a simple example, with no error handling. Kindly enhance the code for better error handling.

Sunday, January 29, 2012

Object reference error when creating a new SILVERLIGHT application

ERROR Message “Object reference not set to instance of an object”

Detailed error starts like :- Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext()

This could be because of the installed version of Silverlight.

Go to Setting -> Control Panel -> Check if Silverlight 5.0 is installed?

If installed, uninstall the Silverlight Version 5.0.x

Download the developer version of Silverlight 4.0.x from the URL from http://go.microsoft.com/fwlink/?LinkID=188039

Friday, January 27, 2012

Create and attach TASK to a CASE on the click of a button

My aim is to create a task and attach the task to a case, on the click of a button.

Step 1 : Add the below two files as a web resource to your solution
json2.js
sdk.rest.js
(These two files can be found in the SDK, path : sdk\samplecode\js\restendpoint\javascriptrestdataoperations\javascriptrestdataoperations\scripts)

In my scenario i have named it sny_SDK.REST and sny_Jason2.

Step 2 : Create a javascript (case.js) file with the below code.

function CreateTaskFromCase()
{
//REMEMBER WE ADDED THIS IN THE PREVIOS STEP
load_script("/SONY/WebResources/sny_SDK.REST");
load_script("/SONY/WebResources/sny_Jason2");
debugger;
CreateTask();
}

function load_script(url) {
var x = new ActiveXObject("Msxml2.XMLHTTP");
x.open('GET', url, false);
x.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
x.send('');
eval(x.responseText);
var s = x.responseText.split(/\n/);
var r = /^function\s*([a-z_]+)/i;
for (var i = 0; i < s.length; i++) {
var m = r.exec(s[i]);
if (m != null)
window[m[1]] = eval(m[1]);
}
}

function CreateTask() {
var task = {};
task.Subject = "Followup Task";
task.Description = "This task was created by the JavaScriptRESTDataOperations sample.";
debugger;
task.RegardingObjectId = { Id: Xrm.Page.data.entity.getId(), LogicalName: "incident", Name: Xrm.Page.data.entity.attributes.get("title").getValue() }
//Add Two Tasks
var today = new Date();
var startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 3); //Set a date three days in the future.
task.ScheduledStart = startDate;
task.PriorityCode = { Value: 0 };
SDK.REST.createRecord(task, "Task", successHandler, errorHandler);
}

function successHandler(entity) {
alert("Created record id is :" +entity.Title);
}

function errorHandler(error) {
debugger;
alert(error.message);
}

Step 3 : Add the above js file to your solution. I have named it as sny_Case


Step 4 : Create a button on the case entity using the 2011 Ribbon Editor (http://crmvisualribbonedit.codeplex.com/)

Call the function "CreateTaskFromCase" refering to the library "///WebResources/sny_Case.

Step 5 : Now open a case record an you can see the button. Click the button and navigate to the activities section to see the task.

Visual Ribbon Editor - MSCRM 2011

Project Description

Visual Ribbon Editor is a tool for Microsoft Dynamics CRM 2011 that lets you edit CRM ribbons. This ribbon editor shows a preview of the CRM ribbon as you are editing it and allows you to easily modify the ribbon without needing to completely understand the underlying XML schema.

Main Features:

* Connects to CRM Online or On-Premise (on-premise should work but hasn't been tested)
* Edit entity ribbons or application ribbons.
* View a preview of the ribbon while editing as it will look in CRM.
* Add new custom buttons to existing groups.
* Add new custom groups to existing tabs.
* Define button text, tooltip, images. and appearance.
* Define button actions, enable rules, and display rules.
* Hide system buttons.
* Quickly save the ribbon back to CRM

Source : http://crmvisualribbonedit.codeplex.com/

Point to note : This tool will create a new solution in your MSCRM instance. So if you want to edit a particular entity you need to make sure that the new solution will take the customizations from your latest solution. In order to make the tool take your latest solution, set your latest solution as your default solution.

Tuesday, August 10, 2010

TAB ON CLICK Called Twice

Use


addEvent(crmForm.all.tab7Tab, "mousedown", iframeHOMEPAGEExplorer);

Monday, June 7, 2010

Adding Many to many Data

//Links (relates) an account record to a lead record in a manyToMany relationship
Moniker moniker1 = new Moniker();
moniker1.Name = "opportunity";
moniker1.Id = new Guid("0D50E716-2757-DF11-AF09-000C29A10E7B");
Moniker moniker2 = new Moniker();

moniker2.Name = "contact";
moniker2.Id = new Guid("0D6BF93F-9D94-4EC1-970B-5E1B1BFBADA2");
AssociateEntitiesRequest request = new AssociateEntitiesRequest();
request.Moniker1 = moniker1;
request.Moniker2 = moniker2;
request.RelationshipName = "ppp_opportunity_contact";
service.Execute(request);

Source : http://blogs.msdn.com/b/crm/archive/2008/02/14/crm-4-0-relationships-explained.aspx