Thursday, April 5, 2018

CRM 2016 Customization and Configuration - Questions and Answers - Managed / Unmanaged solutions

QUESTION 1

You import a managed solution that contains a custom entity named Loan. Loan is enabled for customization.
You need to add a new field to the Loan entity.
What are two possible ways to achieve a goal?

A. Open the imported solution, locate the Loan entity, and then add the new field.
B. Create a new solution, add the existing Loan entity, and then add the new field.
C. Modify the Managed Properties of the Loan entity in the imported solution.
D. Open the default solution, locate the Loan entity, and then add the new field.

Answer : B,D

Learning Points :
  • Managed solutions can not be created.
  • Only Unmanaged Solutions can be created.
  • Unmanaged solution can export as Managed / Unmanaged solution.
  • Managed solution components can be enable for customization by using managed properties.
  • There are two ways to customize component in managed solution which already enabled for customization. 
    • Create/use unmanaged solution, add the component to unmanaged solution and then customize it. 
    • Go to default solution and customize it. 
  • Once customized a managed property, that component will not be revert when managed solution deleted.


QUESTION 2

You have a Dynamics CRM development environment and a Dynamics CRM production environment.You have a project solution in the development environment.
You need to import the solution to the production environment as a managed solution.
What should you do?
 

A. Change the options of the Import Solution dialog box to import the solution as managed.

B. Use the Package Deployer for Microsoft Dynamics CRM to import the unmanaged solution to CRM as managed. 

C. Ask a developer to change the options of the import API so that CRM imports the unmanaged solution as managed. 

D. Export an unmanaged solution and select Managed for the package type. Import the exported solution to the production environment.

Answer : D

Learning Points :
  • Managed solutions can not be created.
  • Only Unmanaged Solutions can be created.
  • Unmanaged solution can export as Managed / Unmanaged solution.
  • Can not convert Unmanaged solution to Managed solution while Importing. 


QUESTION 3

You are preparing entity customizations that will be exported as part of a managed solution.
You need to identify for which field types of an entity you can customize the Managed Properties.
Which two field types should you identify? Each correct answer presents a complete solution.


A. a custom field on a system entity 

B. a system field on a system entity 
C. a custom field on a custom entity
D. a system field on a custom entity

Answer : A,C

Learning Points : Managed Properties


QUESTION 4

You import a managed solution to a Dynamics CRM organization. The solution contains a new entity named Loan. The Loan entity is not referenced by any other solutions in the organization.
After a few months, the decision is made to stop using the solution.
You need to identify what will occur to the entity definition and the entity data if you attempt to delete the solution.
What should you identify?

A. The solution will be deleted, but the entity data will remain for historical reference. 
B. You will be prevented from deleting the solution. 
C. You will be prompted to export a copy of the data during the delete process. 
D. The entity definition and the entity data will be deleted.


Answer : D

Learning Points : 
  • When a Managed solution deleted all the containing components will be removed from CRM.
  • Unless Managed solution contains customization enabled component and that component has modified. In that case modified component will remain in CRM and other components will removed with Managed solution.

Thursday, March 7, 2013

DataTable Copy() vs Clone()

Considering two methods Copy() & Clone() for System.Data.DataTable

Copy() - copy both structure and data from source table to new table
 

Clone() - copy only the structure of source table to new table
 

Thursday, December 13, 2012

Submit Form with link

As my title says today’s topic also ‘simple & useful’,
Most of user Interface engineers prefer links instead of buttons, which is easy to style. So will use…

Submit with Button
 <input type="submit" value="Submit"/>  

Submit with Link
 <a href="javascript:void(0)" onclick="$(this).closest('form')[0].submit();">Submit</a>  

Thursday, July 7, 2011

Custom attributes & Enum 2

Display values of custom attribute in Drop Down

Is there any advantage of adding custom attribute in Enum?

I want to bind some Cartoon Character names to drop down box; these values keep as Enum in my project. As we all know Enums doesn’t support spaces and special characters. So… use custom attribute

Method to get Enum as a collection

        public static IEnumerable<CartoonCharacters> GetCommenttype()
{
yield return CartoonCharacters.TinTin;
yield return CartoonCharacters.SpongeBob;
yield return CartoonCharacters.SpiderMan;
yield return CartoonCharacters.BugsBunny;
yield return CartoonCharacters.TomAndJerry;
yield return CartoonCharacters.DonaldDuck;
}

If you think yield keyword is new to you, I found two great articles

Using C# Yield for Readability and Performance
Behind the scenes of the C# yield keyword


Method to bind data
        public static Dictionary<CartoonCharacters, string> GetCartoonCharacters()
{
var list = new Dictionary<CartoonCharacters, string>();

foreach (CartoonCharacters item in GetCommenttype())
{
list.Add(item, GetDescription(item));
}

return list;
}


Don’t forget to bind data collection with drop down
 ddlCartoonCharacters.DataSource = GetCartoonCharacters();
ddlCartoonCharacters.DataTextField = "value";
ddlCartoonCharacters.DataValueField = "key";
ddlCartoonCharacters.DataBind();


Final look

blog

Custom attributes & Enum

Formal introduction to Enum: provides an efficient way to define a set of named integral constants that may be assigned to a variable.

As we use enums in our day today life, we may need small improvements and additional things integrated with enums.

This is my Enum (without custom attribute)

public enum CartoonCharacters
{
TinTin = 1,
SpongeBob = 2,
SpiderMan = 3,
BugsBunny = 4,
TomAndJerry = 5,
DonaldDuck = 6
}



I’m going to integrate descriptive text (some extra values) with my CartoonCharacters enum.

Enum with Description


public enum CartoonCharacters
{
[Description("Tin Tin")]
TinTin = 1,

[Description("Sponge Bob")]
SpongeBob = 2,

[Description("Spider Man")]
SpiderMan = 3,

[Description("Bugs Bunny")]
BugsBunny = 4,

[Description("Tom And Jerry")]
TomAndJerry = 5,

[Description("Donald Duck")]
DonaldDuck = 6
}

public class Description : Attribute
{
public string Text;

public Description(string text)
{
Text = text;
}
}



  Method to read the description


    public static string GetDescription(Enum en)
{
Type type = en.GetType();
MemberInfo[] memInfo = type.GetMember(en.ToString());

if (memInfo != null && memInfo.Length &gt; 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(Description), false);

if (attrs != null && attrs.Length &gt; 0)
return ((Description)attrs[0]).Text;
}
return en.ToString();
}