Wednesday, September 5, 2012

How to open CRM FORMS and Web Resources correctly!?


Some CRM implementations require the use of custom Jscript to pop open a new entity form window or a window displaying an existing record in CRM. Previously, there was no “supported” way to do this, since we had to use the window.open Jscript object which relies on the use of the Document Object Model (DOM).

Update rollup 8 provides new SDK functions which CRM configurators can use to open CRM forms and web resources in a nice supported way.

The Old Way - Making the URL static with parameters:
Here is an example of how to pop open an existing Account using Jscript:

function popAccount() {
var accountId = "8FB2CCE4-20E4-E111-9700-00155D042F0D";
var url = Xrm.Page.context.getServerUrl() + "/main.aspx?etn=account&id=" + accountId + "&pagetype=entityrecord";
window.open(url);
}

Here is an example of how to pop open an HTML Web Resource using Jscript:

function popHTML() {
var url = Xrm.Page.context.getServerUrl() + "//WebResources/iaf_/html/test.html";
window.open(url);
}

Although these methods do work, they could potentially break as new rollups are applied to your system, or when CRM 2011 is available on multiple browsers.

The New way - New functions :)

function popAccount() {
var accountId = "8FB2CCE4-20E4-E111-9700-00155D042F0D";
Xrm.Utility.openEntityForm("account", accountId);
}

If we wanted to pop open a new Account form, we can exclude the ID parameter.
Here is an example of how to pop open an HTML Web Resource using Jscript:

function popWebResource() {
var webResourceName = "iaf_/html/test.html";
Xrm.Utility.openWebResource(webResourceName);
}

Please note this is only a few of New functions released in rollup 8 related to "Xrm.Utility"  :)

Happy Xrm'ing!

Source: http://blogs.msdn.com/b/crm/archive/2012/07/18/new-xrm-utility-functions-in-update-rollup-8-for-microsoft-dynamics-crm-2011-and-microsoft-dynamics-crm-online.aspx

Wednesday, May 30, 2012

The view: "Products in Parent Price List" is gone!?

This article talks about a parent look view which is never visible after the “Display search box in lookup diaglog” is checked while customizing Opportunity Product Entity in CRM 2011. There is an easy workaround to get back to old view.

How do I revert to old view?

If you’re thinking that you can just go and uncheck. No then that’s not a solution. We will need to revert through a customization tweak. The reason for this and by now CRM has reset the view id. Hence it shows a different view.
The following are steps to achieve that
  1. Go to Settings > Solutions
  2. Add new Solution and provide a valid name to it.
  3. Save the solution.
  4. Now add existing entity, “Opportunity Product”
  5. Export the solution as unmanaged
  6. Open the unmanaged solution in notepad and locate the following:
  7. Replace {8BA625B2-6A2A-4735-BAB2-0C74AE8442A4} with {BCC509EE-1444-4A95-AED2-128EFD85FFD5}
  8. Save the changes
  9. Zip the files and import the solution back to your environment
  10. Publish the customizations
  11. Refresh the CRM in your browser
  12. You will see the correct view.
Tip: The GUIDS in step 7 could be found in the DB or in the URL of a "clean CRM" dialog for opportunity lookup

Happy XRM'ing!

Friday, April 13, 2012

CRM2011 Setup and Upgrade Errors With Resolutions

When upgrading from CRM 4.0 to MS CRM 2011 you might bump into serveral issues, I've listed some of the most normal serarios :)

"Fragmented indexes were detected in the Microsoft Dynamics CRM database",
This might accure during the import of the organizations:

Resolution:
Re-index the organisation databases (A SQL script)

USE MyDatabase
GO
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
GO
EXEC sp_updatestats
GO

Updating statistics ensures that queries compile with up-to-date statistics

'System.ServiceModel.Channels.ReceivedFault' in Assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b73a53451934e545' is not marked as serializable
Error when testing Email router:

Resolution:
Add the account running the email router services to PrivUserGroup security group.

SQLSERVERAGENT (SQLSERVERAGENT) service is not running on the server ......


Resolution:
· Check if SQLSERVERAGENT service is running
· Open the port 445 for SQL Server


Microsoft.Crm.Web.Reporting.SrsReportViewer.SetExecutionCredentials(ServerReport reportObj) Cannot create a connection to data source 'MSCRM'. (rsErrorOpeningConnection)
The error message gets received when accessing the reports from any of the organizations:

Resolution:
· Add SSRS service account to privreporting group.
· Reinstall the reporting extension again using deployment account.

The process to resolve was as follows:

1. Uninstall the Reporting Extensions.
2. Go to the CONFIG DB (MSCRM_CONFIG) of CRM and update your organization's row in the Organization table to set the AreReportsPublished boolean field to FALSE.
3. Re-install the Reporting Extensions and they should publish the reports again.

Note: You will see the message about installation is republishing the reports again

Unknown labels in settings group

Resolution:
Follow the Microsoft article for resolution: http://support.microsoft.com/kb/2530358.

Happy XRM'ing!

Saturday, April 7, 2012

Startup script Onload AND Onsave! Basic's for every Jscript!

Tired of having XX web-resurces on a form? Well.. Now you can controll everything within one JS with only 1. trigger:
- OnChange
- Onload
- OnSave

as well as:
- For all form types: OnCreate, OnNewForm, onReadonly ++

Read more about this in my previous post: Best javascript startup script ever
/* Script Entry Point */
function OnCrmPageLoad() {
 var FormTypes =
 {
Undefined: 0,
Create: 1,
Update: 2,
ReadOnly: 3,
Disabled: 4,
QuickCreate: 5,
BulkEdit: 6
 }
 runAlways();
 switch (crmForm.FormType) {
 case FormTypes.Create: OnNewFormLoad(); break;
 case FormTypes.Update: OnUpdateFormLoad(); break;
 case FormTypes.ReadOnly: OnReadOnlyFormLoad(); break;
 case FormTypes.Disabled: OnDisabledFormLoad(); break;
 case FormTypes.QuickCreate: OnQuickCreateFormLoad(); break;
 case FormTypes.BulkEdit: OnBulkEditFormLoad(); break;
 case FormTypes.Undefined: alert("Error"); break;
 }
}
/* Implement each Form Type you wish to address */
function runAlways() {
 onchange();
 Xrm.Page.data.entity.addOnSave(addToOnSave);
}
function OnNewFormLoad() {
}
function OnUpdateFormLoad() {}
function OnReadOnlyFormLoad() { }
function OnDisabledFormLoad() { }
function OnQuickCreateFormLoad() { }
function OnBulkEditFormLoad() { }
/******************** OnChange and OnSave functions ***************************/
function onchange(){
 //Skriv inn alle felter som skal ha OnChange
 Xrm.Page.data.entity.attributes.get("prefix_field").addOnChange(Summering);
}
function addToOnSave() {
 var SAVE_MODE_SAVE = 1;
 var SAVE_MODE_SAVEANDCLOSE = 2;
 // Validate only if the user clicked "Save".
 switch (event.Mode){
 case SAVE_MODE_SAVE:
  //Do something for "save"
  if(/*write you check*/) {
   // Cancel the save operation.
   event.returnValue = false;
   return false;
  }
  break;
 case SAVE_MODE_SAVEANDCLOSE:
  //Do something for "Save and close"
  if(/*write you check*/) {
   // Because this is a "Save and Close",
   // just save the form.
   return true;
  }
  break;
 }
}
/*************** End OnChange and OnSave functions ***************************/
/* --------------- Private functions ---------------------*/
function Summering(){
alert("You are inside a function triggerd from a onChange");
}
/* ------------ End Private functions------------------*/

Tuesday, March 6, 2012

Creating a "Update Account Dialog"

Soon I'm going to publish a dialog that updates an account. with several information:
- Contacts and roles that are req for business regarding marketing, sales ++

Senario:
A company need to update all accounts with certain roles (g.ex IT responseble, CEO, Sales responseble) before a huge invitation is sendt thou CRM, and plan to give this task to the account owners (account responsebles).. They want a sort of easy way to remind the account responsebles to do this, and do it the fastest way posseble..



This video only dispaly an example, you could easly update this dialog gathering other kind of information!

Thursday, March 1, 2012

Nye muligheter med Microsoft Dynamics CRM 2011

Crayon Solutions har gleden av å invitere deg til frokostmøte 21. mars.
Page Cont
​​Her får du en oversikt over de viktigste nyhetene i Microsoft Dynamics CRM 2011 og hvilke muligheter og metode som finnes for oppgradering fra Microsoft Dynamics CRM 4.0.
Vi håper du har anledning til å delta, og vi gleder oss til å treffe deg! Inviter gjerne andre i din virksomhet som dette kan være relevant for.

Sted:
Lysaker Torg 45 i Microsoft sine lokaler.
Dato: Onsdag 21. mars
Tid: kl.09:00-11:00 (registrering og frokost fra kl. 08:30)



Thursday, February 23, 2012

A few new codeplex solution I can't live without!

http://mapsforcrm2011.codeplex.com/- The best solution for "integrating" bing maps into CRM! I love the latitude get function!

Silverlight Application to show multiple entity records on Bing map. Idea is to show records from any number of entities and provide user some additional capabilities(explained below). Also, the content displayed on the map is configurable.

http://crmvisualribbonedit.codeplex.com/
- I love it when it comes to hiding function from ribbon!

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

http://crm2011autonumber.codeplex.com/
This is a solution for crm 2011 (hosted/on-premise) for autonumbering the configurated entity.
(For online use I pref: Auto-number-for-dynamics-crm-2011 from GAP)

Friday, January 20, 2012

Custom Report for CRM 2011 Online tips and tricks

Hi, it's time to look at tips and tricks for custom Reporting Services report for CRM 2011 online!
- In this case we'll use FetchXML to connect to the CRM data! :)

Requirements:
  • Microsoft SQL Server 2008 or 2008 R2 Business Intelligence Development Studio (BIDS) installed
  • Microsoft Dynamics CRM 2011 BIDS Fetch Extension installed
  • Microsoft Dynamics CRM 2011 Online account
All this is allready installed in movie! So please install before watching movie if you're going to follow my movie to learn..

A nice blog about installing + basic setup: FetchXML - BIDS install - CRM 2011

Please note the following limitations:
  • You cannot specify left outer joins – e.g. The following is not supported: “Select all Accounts who do not have a related Completed Appointment record”
  • You cannot specify group by / sum queries – e.g. The following is not supported: “Select Account Name, count(*), sum(est. value) from Account Group By Account Name” – You can only select the records in detail and then perform the aggregation in your report. But…
  • Fetch XML queries return a maximum of 5000 records.
In these movies you'll see the following:

Part 1:
- Explaining how to setup the authentification to server
- Explaining hoe to get the fetchXML from CRM that you need.
- Showing the wizard and telling a bit tricks and tips
Part 2:
- Explaining Datasets and data sources
- Showing how to create parameters
- Basic GUI for reports
Part 1: 

Part 2:

 
Hope you found this usefull! :)

Friday, January 13, 2012

Several Basic Javascripts part 2

Hi, more basic javascripts!! Yes, we love them and hate them! Please read Several Basic Javascripts Part 1 aswell!

Get value of lookup: Xrm.Page.getAttribute("prefix_fieldname").getValue()[0].name
- read method as: get array 0's name (or Id)

Set Value of lookup:
var idValue = "2B0CDF21-7C04-E011-8ABA-00155D011B05"; //GUID of record
var textValue = "Prisliste"; //Name of record
var typeValue = "Pricelevel"; //Schema name of record entity
Xrm.Page.getAttribute("prefix_fieldname").setValue([{id: idValue, name: textValue, entityType: typeValue}]);

Show/hide section: Xrm.Page.ui.tabs.get(1).sections.get("Section_name").setVisible(false)
Set visible values: true or false
Tab value: number (1) or "name"
Section value: "name_of_section"

Show/hide field: Xrm.Page.getControl("prefix_fieldname").setVisible(false)
Set values: true or false

Show/hide tab: Xrm.Page.ui.tabs.get(5).setVisible(false);
Set Values: true or false

Save: Xrm.Page.data.entity.save();
Optional params: "saveandclose" or "saveandnew"

Set Require lvl: Xrm.Page.getAttribute("prefix_fieldname").setRequiredLevel('required');

Get length of string:
var oField = Xrm.Page.getAttribute("prefix_fieldname").getValue();
alert(oField.length);

Substract content of string:
var oField = Xrm.Page.getAttribute("prefix_fieldname").getValue();
alert(oField.substr(0,7);

Ex: "Consultancy" --> after substract: "Consult"

Set Focus:
Xrm.Page.getControl("prefix_fieldname").setFocus(true);

Hope you found this usefull! :)