Pages

Tuesday 20 November 2012

Add Multiple Entities to "Look for" optionset in Lookup Field in crm 2011 Using Javascript

If you create custom lookup in CRM, this lookup is oriented only for one entity.
I want to add possibility to select from some entities in one lookup.

I have custom lookup "originatingleadid". This lookup is oriented on Lead entity. I want to select from views of three different entities: Lead, Contact, User.

For this I've done some customization in opportunity entity, I've created three hidden text fields:
new_type - to save lookup type
new_guid - to save lookup guid
new_name - to save lookup name.
That is all customization.

I've developed three javascript function:

1. function to handle OnChange event on lookup.


function onchange()
{
var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
if (IsNull(originatingLeadValue) || originatingLeadValue[0].type == "4")
{
// Lookup is null or there is a Lead, need to clear hidden fields. To clear one of them will be enough, we will be check this field during onload.
Xrm.Page.getAttribute("new_guid").setValue(null);
}
else
{
// Lookup contains Contact or User, so need to store lookup properties to our hidden fields.
Xrm.Page.getAttribute("new_type").setValue(originatingLeadValue[0].type);
Xrm.Page.getAttribute("new_guid").setValue(originatingLeadValue[0].id);
Xrm.Page.getAttribute("new_name").setValue(originatingLeadValue[0].name);
}
}

2. function to handle OnSave event on Opportuniry Form.

function onsave()
{
var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
if (!IsNull(originatingLeadValue) && originatingLeadValue[0].type != '4')
{
Xrm.Page.getAttribute("originatingleadid").setValue(null);
}
}
 3. function to handle OnLoad event on Opportunity Form.

function onload()
{
lookuptypeIcons = '/_imgs/ico_16_2.gif:/_imgs/ico_16_4.gif:/_imgs/ico_16_8.gif';
lookuptypenames = 'contact:2:Contact,lead:4:Lead,systemuser:8:User';
lookuptypes = '2,4,8';
var savedId = Xrm.Page.getAttribute("new_guid").getValue();
var savedType = Xrm.Page.getAttribute("new_type").getValue();
var savedName = Xrm.Page.getAttribute("new_name").getValue();
var savedEntityName = savedType == "8" ? "systemuser" : "contact";
document.getElementById("originatingleadid").setAttribute("lookuptypes", lookuptypes);
document.getElementById("originatingleadid").setAttribute("lookuptypenames", lookuptypenames);
document.getElementById("originatingleadid").setAttribute("lookuptypeIcons", lookuptypeIcons);
document.getElementById("originatingleadid").setAttribute("defaulttype", "4"); // default type - Lead entity
var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
if (IsNull(originatingLeadValue) && !IsNull(savedId))
{
var value = new Array();
value[0] = new Object();
value[0].displayClass = "ms-crm-Lookup-Item";
value[0].keyValues = new Object();
value[0].values = new Object();
value[0].onclick = "openlui()";
value[0].id = savedId;
value[0].entityType = savedEntityName;
value[0].typename = savedEntityName;
value[0].name = savedName;
value[0].type = savedType;
Xrm.Page.getAttribute("originatingleadid").setValue(value);
}
}
So, now you can select from  three different entity in one lookup :-)
Custom Lookup view

Thursday 15 March 2012

How to access Network Path folder from CRM using Javascript

The following function is used to get Network folder in our computer from CRM application.

Here we have to give a Network address path in CRM page. The folder will open when we click on that link from CRM.

function OnLoad(){   
Transform("fieldname");
}
function Transform(fieldid){  
 var c = document.getElementById(fieldid);
   if (c == null)   
    return;
   c.style.textDecoration = "underline";
    c.style.color = "blue";
   c.style.cursor = "hand"; 
  c.ondblclick = function()    {
       window.open(Xrm.Page.getAttribute(fieldid).getValue()); 
  };
}

Wednesday 29 February 2012

Preparing for Exam MB2-866: Microsoft Dynamics CRM 2011 Customization and Configuration

Like most people, I don’t generally like taking tests. But like some people, sometimes I really like taking tests. For me, the fun tests are the ones where you know the subject matter well, the questions are reasonably well-written, and are about important concepts. In my view, the Dynamics CRM exams have usually met these criteria, and the Dynamics CRM 2011 Customization and Configuration exam (MB2-866) definitely meets them.
I took it last week and immensely enjoyed it. It’s significantly different from the 4.0 exam, which isn’t surprising since Dynamics CRM 2011 has so many new features in the customization and configuration topic area. So if you’re preparing for this exam, I hope you find this little prep-guide helpful. And if you do, here’s something you may find even more helpful: I’m kicking off my Dynamics CRM 2011 exam prep series with a 3-day live online training program in November, and if you want to register or get more information, please visit our CRM 2011 Certification Prep page.

Exam Nuts & Bolts

The exam itself is long: there are 75 questions and you must score a minimum of 700 points to pass. I’m not sure how the questions are weighted, so it’s hard to know exactly how many questions you need to get right to pass, but the old rule was that 70% was the minimum passing score, and my guess is that’s still about right.
You get almost three hours to take it (2 hours and 30 minutes if I recall correctly), and how much time you need obviously depends on how well you know the material. You can mark questions for review. My advice here is on your first pass through, try to answer all the questions, and mark for review only the ones that are not easy or obvious. If you get to 75 and find that you’ve marked 90% plus of the questions for review…well, that’s not good! J
There are two main kinds of questions:
  • Multiple choice with only one answer correct (option buttons)
  • Multiple choice with multiple possible correct answers
The problem with the second kind is that you don’t know how many correct answers there are. I thought I remembered the CRM 4.0 exams indicated how many were correct (”select the two best options”), but in any case, this time you don’t know how many to choose.
Generally I’d say the test design was fine. That is, there weren’t very many poorly worded questions, you could usually tell what the point of the question was, I can’t remember any single-answer questions where I thought there were more than one that was correct, and so forth. Test design is difficult, however, and I’ve (still) yet to see a certification exam I’d consider flawless. On the current state of the MB2-866 exam, I’d say the test design is as good as it needs to be: poor test design will not be the reason somebody doesn’t pass the test.

Topic Area Overview

Here I’ll survey the topic areas, including their percentage weights from the exam page, and give you some highlights and things to look out for in each one. One caveat: when you take the test you don’t know which topic area any particular question is from. And if you look closely at the Skills Measure tab on the test page (here: http://www.microsoft.com/learning/en/us/exam.aspx?ID=MB2-866#tab2 ) you will see there’s some overlap. For example, the first topic area (organizational structure) includes a sub-area for “managed solutions and properties”, yet there’s an entire topic area (the last one) called “Implementing a Microsoft Dynamics CRM Solution”. This is confusing, but it’s important: the number of questions I got on various aspects of solutions seemed to me well over 13% of the total, which would come as a surprise if you didn’t realize that general topic comes up in more than one of these topic areas!
Anyway, here goes, with a focus on what’s new in Dynamics CRM 2011.
Configuring a Microsoft Dynamics CRM Organizational Structure (15 percent)
  • Business Units. Business units can be deleted in CRM 2011 under certain conditions, so be sure you know what those are. Make sure you are familiar with default teams for business units.
  • Architecture Concepts, where and how to customize Dynamics CRM. Understand which customization options are different between Dynamics CRM Online and on-premise.
  • System Settings. Understand the new system settings, such as currency precision, auditing, goals. Understand how Language settings work (on the Administration page), and how Currencies and Fiscal Year settings work (both on the Business Management page).
  • Solutions. This is a big topic – I’ll cover it below.
Managing Users & Teams and Security (15 percent)
  • Security roles themselves work essentially the same in CRM 2011 as in CRM 4.0. But…there are so many new things to secure in CRM 2011 that there are a lot more options! For example, you can understand how the entity-based and task-based privilege model works, but if you don’t understand how in Dynamics CRM 2011 it’s applied to things like who can manage solutions, and who and how you can control access to charts and dashboards, and all the other new stuff, you’ll have a hard time with a lot of the questions on the test!
  • Append and Append to. Just remember: if you don’t have append privilege on an entity you can’t append it to anything; if you don’t have append to you can’t append anything to it.
  • Teams are a full-fledged security principal in CRM 2011. This is one of the most important improvements in the security model, and it’s well represented on the test. Make sure you know how to maintain teams, add users to teams, assign security roles to teams, when teams can be deleted and what the implications are, and so forth.
  • Field Security is an important new feature and again well represented. Know what kinds of fields it can be applied to (custom fields only!), how it’s done, and who can do it.
  • Maintaining user accounts is reasonably similar to how it was in CRM 4.0. Make sure you know what’s required to add users (e.g. you can add a user without a security role but not without a business unit), whether you can delete users (no), what happens to users if their business unit is disabled (they can’t access CRM but they still take up a license!), what happens to records owned by a user whose account is disabled (pretty much nothing), how to bulk reassign records, and the like.
Customizing Attributes and Entities (16 percent)
This may be the most detailed topic area on the exam. For example…
  • Option sets get a lot of coverage, and make sure you understand global option sets. For example, work through what happens if you use a global option set on forms for two different entities and change it from one of them.
  • Make sure you have detailed knowledge of the different data types available for custom fields, and which field properties can be changed after saving a field.
  • When you create a custom entity, which settings can be changed after saving and which cannot? If you define a new entity as an activity entity can you change your mind about that or about whether it’s displayed in the Activity Menus? (no and no). Can you change your mind about support for Notes, Activities, Connections, Sending e-mail, Mail-merge, Document Management or Queues? (no, no, no, no, yes, yes, no). How about Duplicate detection or Auditing? (yes and yes).
Customizing Relationships and Mappings (15 percent)
Of all the topic areas on this exam, this one is probably the most similar to CRM 4.0. Here are a few things to keep in mind:
  • Make sure you really understand the ins and outs and N:N relationships, especially the differences between native N:N’s and manual N:N’s using an intersection entity.
  • Understand how Connections implement N:N relationships. (Connections are new in CRM 2011)
  • Understand how you can access relationship properties (e.g., through form navigation – this is new in CRM 2011) and what you can customize once you get there (the difference between Parental, Referential, Referential (Restrict Delete) and Configurable Cascading – this is the same as in CRM 4.0)
  • Know what mapping does and doesn’t do.
Configuring Auditing (9 percent)
  • Who can configure auditing?
  • How do you configure audit partitions? Which ones can be deleted and when?
  • What version of SQL Server (on-premise, of course!) do you need to configure audit partitions?
  • Can auditing be turned on and off for an entity? If it’s on, which fields are audited by default? If it’s on, are schema customizations audited? (yes, all of them, and yes)
Managing Forms, Views, and Charts (17 percent)
Lots of new stuff in this topic area!
  • How do you create multiple forms for an entity and what can they be used for? How are they assigned to security roles?
  • What’s the difference between system-defined and public views? (same as in 4.0) Can public views be deactivated? (yes, new in 2011)
  • Make sure you know the ins and outs of lookup, associated and quick find views.
  • Can you export a chart’s XML definition file, modify it, and then import it? (yes) If so, what is that good for? (CRM can display multi-series charts, but the chart designer can’t create them, for example)
  • Can you create a personal chart, export its XML definition file, and then import that as a system chart? (yes) If so, what’s that good for?

Implementing a Solution (13 percent)

When you consider that you get questions on this in other topic areas, it really means it accounts for more than 13% of the total questions. Plus it’s all new, so make sure you’re up to speed on topics like these:
  • What are all the different components that can be part of a solution? Which of those components are form-enabled?
  • What are the differences between managed and unmanaged solutions?
  • When do you create a managed solution? (when you export it)
  • What happens if you import several managed solutions on top of each other? How does conflict resolution work?
  • How do solution versions work? What happens when you import a new version of an existing managed solution?
  • What are managed properties for and where do you configure them? (they control whether somebody can customize components of a managed solution, but they are configured in the unmanaged solution!)
  • You need drill-down detail knowledge about what the managed property options are for different components (e.g., entities, forms, views, fields and so forth), as well as for the differences between system entities and custom entities. Here’s an informal treatment of the subject:
Here are the possible managed properties for a custom entity:
In addition to managed properties at the entity level, they can also be set at the form level:
The view level:
The field level:
Charts are like forms and views: each one either can be customized, or not.
System entities, and system attributes of system entities are different: they cannot be locked down as part of a managed solution. For example, for account:
Account name field on account:
Same for the other customizable components (views, forms, charts). But for custom components of a system entity, those can be locked down according to the same rules. For example, here are the managed properties for a custom chart of a system entity: