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! :)

Monday, December 19, 2011

CRM 2011 Dialog guide

Hi, one of my favorite new features of CRM 2011 is Dialogs! This is more of a interactive workflow where the user gets guided thou a prosess.

To explain Dialogs, I've created a simple use-case: This is part 1 out of x !? ;)
I have a lot of leads and want to create a custom lead convert.
1. I want to check if the lead have a company allready in CRM as an account
2. I want to check if it exists two leads against same company
- + You could add more checks

So let's get dirty and create this dialog :)

First thing first:
Start by planning the keyelements you'll be needing in this Dialog.
1. We'll going to need two queries.
  • Find all Accounts that might be a duplicate.
  • Find all Leads that might be the same company.
2. The steps we're going to need are:
  • Build up Queries
  • Check the Queries
3. Have a basic thought of the logic under each step:
Build up Queries
  • Find all Accounts where: Accountname in Accounts entity equals/contains Company field in selected lead
  • Find all Leads where: Company field in selected lead equals/contains company field in other leads
Check the Queries
  • If  the query "Find all Accounts that might be a duplicate." contains more then zero records AND the query "Find all Leads that might be the same company." contains more then one recod. (Since we running dialog on one of them)
    • Promt user and ask what to do
  • Else if:
    • "Find all Accounts that might be a duplicate." contains more then zero records
      • Promt user and ask what to do
    • "Find all Leads that might be the same company." contains more then one record
      • Promt user and ask what to do
  • Default:
    • Promte user and tell no duplicates or other leads are found, ask what he wanna create:
      • Create Account: Yes/No
      • Create Contact: Yes/No
      • Create Opportunity Yes/No
    • if Create Account equals yes
      • Start Child Dialog "Create Account"
    • if Create Contact equals yes
      • Start Child Dialog "Create Contacs"
    • if Create Opportunity equals yes
      • Start Child Dialog "Create Opportunity"
The reason why it's important to have a basic drawing of these steps and if's are that it's hard/impossible to re-design the dialog when first started. (You can't re-design the logical hierarki)

Let's build this Dialog! I've created a videoguide as I'm to lazy typing down every detail and taking lots of screenshots :P

Part 1:
Creating the basics for the dialog:
(Note I'm doing one error! The IF ("Find all Leads that might be the same company." contains more then one record. I'll correct the error in next part!)
Part 2:
Creating the default action (Normal convert)
Part 3:
Creating the what will happen if "Find all Leads that might be the same company." contains more then one record
Part 4:
Creating the what will happen if "Find all Accounts that might be a duplicate." contains more then zero records

Part 5:
Creating the what will happen if "Find all Accounts that might be a duplicate." contains more then zero records AND the query "Find all Leads that might be the same company." contains more then one recod.
Good luck devoloping futher!!