Tuesday, 22 March 2016

Security Roles and Access Rights in CRM

Hi,
 
Security roles are the most complex concept in Dynamics CRM Security model. Here is my 2 cents about it.
 
Lets divide the security roles concepts into two pieces.
 
1) Privileges
Privileges are the basic units about an actions a user can perform on CRM. These actions predefined which cannot be added or delete but can be modified.
  • Create - Allows the user to add a new record.
  • Read - Allows the user to view a record.
  • Write - Allows the user to edit a record.
  • Delete - Allows the user to delete a record.
  • Append - Allows the user to attach other entities to, or associate other entities with a  parent record
  • Append to - Allows the user to attach other entities to, or associate other entities with the record.
  • Share - Allows the user to share a record with other Users/Teams.
2) Levels of Access
The Access Level determines, for a given entity, at which levels within the organization hierarchy a user can access.
  • None - No privileges given.
  • User - Privileges to the records owned by the user or shared with the user. Also includes the privileges owned by the team to which the user belongs.
  • Business Unit - Privileges for all records owned in the business unit to which the user belongs.
  • Parent: Child Business Unit - Privileges for all records owned in the business unit to which the user belongs and to all the child business units subordinate to that business unit.
  • Organization - Privileges for all records in the organization regardless of who owns.
Hope this helps.
 
--
Happy CRM'ing
Gopinath

Saturday, 19 March 2016

Move records automatically to Owner's Queue

Hi,

Today, we got a requirement from Customers to all the Tasks created in the system should move to the Owner's respective queue. Then we were thinking of the custom approach and then we got a doubt it should be available in OOB CRM with some configuration settings. After checking, yes it is available.

Go to Customizations -> Entity Information -> Tick the check box which is available just below the Queues as shown in the figure.

Hope this helps.
--
Happy CRM'ing

Gopinath

Wednesday, 16 March 2016

Export and Import Product Catalog in CRM

Hi,
 
CRM provides very easy and rich interface to configure Product Catalog that will help the company to sell products and services.
 
Most of the times, we would be creating Product Catalog in one system and wanted to move from one CRM to other CRM. After the Product Catalog is fully built and tested on one of the CRM systems, we can always export the complete catalog and import to other systems using Data Migration tool.
 
Here is the procedure of exporting and importing catalog from one CRM system to other.
 
1) Download SDK, Navigate to Tools-> Configuration Migration
2) Double click on DataMigrationUtility
3) Select Create Schema
4) Give CRM Credentials
5) Select the Organization where Product Catalog was properly configured
6) Select the Solution, the application will automatically gets all the entities in the solution and shows in the dropdown. Select Product entity and click on Add Entity button.
7) Select the below entities and click on Entity
  • Product
  • Product Association (needed for bundles)
  • Product Relationship (not a mandatory entity, needed only for relationships)
  • Property
  • Property Association
  • Property Option Set Item
  • Notes (needed, if there are any notes for the product)
  • Currency
  • Price List
  • Price List Item
  • Unit
  • Unit Group
  • Territory (needed if there is a default price list configuration)
  • Connection (needed, if there is a default price list configuration)
  • Competitor (needed, if there are any competitors for product)
  • Sales Literature and Sales Literature Item (needed, if there is any sales literature for product)
  • Discount (not a mandatory entity, needed only for discounts when added to price lists)
  • Discount List (not a mandatory entity, needed only for discounts)
8) click on Save and Export button

 9) Choose the location to save Schema
10) Click Yes on the Pop Up.
11) Select the location to save the Data file and click on Export Data button.
12) Now open the same tool again and select Import Data
13) Give the credentials and connect to organization where you want to copy the data.

14) Browse the Zip file which was created by the Export Process and click on Import Data.

Hope this helps.
 
--
Happy CRM'ing

Gopinath 

Tuesday, 15 March 2016

Spaces in Enums

Hi,
 
Today when I was working with Enums and was blocked by a scenario where I need a Space in between the words of Enum. We all know that in Enums we cannot have a space. I was searching for solution and came to know that we can have a desciption as an annotation to the Enum item and read by reflections.
 
Here is the code for reading the description.
 
I have the below enum
 
public enum Date
{
   /// <remarks/>
   [Description("Created Date")]
   CreatedDate,
}
Below is the code which gets the description of Enum

public static string GetEnumDescription(Enum value)
{
     FieldInfo fi = value.GetType().GetField(value.ToString());
     DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
     if (attributes != null && attributes.Length > 0)
     {
           return attributes[0].Description;
     }
     else
     {
           return value.ToString();
     }
}
 
Output

static void Main(string[] args)
{
    string strValueWithOutSpace = Date.CreatedDate.ToString();
    string strValueWithSpace = GetEnumDescription(Date.CreatedDate);
    Console.WriteLine("Without Space : " + strValueWithOutSpace);
    Console.WriteLine("With Space : " + strValueWithSpace);
    Console.Read();
}

 
Hope this helps.
 
--
Happy Coding

Gopinath

System.Configuration.ConfigurationSettings.AppSettings' is obsolete: '"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings"

Hi,

Whenever we read values from configuration, the people who worked on earlier versions of .net has a habit of writing the below line of code for reading values from configuration.

string strValue = System.Configuration.ConfigurationSettings.AppSettings["KeyValue"];

The fix is very simple, just add System.Configuration as reference to your project and change ConfigurationSettings to ConfigurationManager. You don't see any warning now.

string strValue = System.Configuration.ConfigurationManager.AppSettings["KeyValue"];

Hope this helps.

--
Happy Coding
Gopinath

Monday, 14 March 2016

Get ObjectTypeCode of the entity in CRM

Hi,
 
Here is the C# code to get the OjbectTypeCode of the entity in CRM.
 
private static int GetEntityTypeCode(string EntityName)
{
      RetrieveEntityRequest request = new RetrieveEntityRequest();
      request.LogicalName = EntityName;
      // Retrieve the MetaData.
      RetrieveEntityResponse response = (RetrieveEntityResponse)crmService.Execute(request);
      int objecttypecode = response.EntityMetadata.ObjectTypeCode.Value;
      return objecttypecode;
}
 
Hope this helps.
 
--
Happy CRM'ing

Gopinath

Friday, 11 March 2016

Save and Save & Close buttons are not visible in CRM 2013/2015

Hi,
 
Today when we open the CRM forms observed that Save and Save & Close were not visible. When we are checking the things we found that one of our colleagues has enabled Auto-Save feature in CRM.
 
If you enable Auto-Save - Save and Save & Close buttons will not be displayed. Refer the below screen shot for more information
 
Auto Save Disabled
Save and Save & Close buttons are visible
Auto Save Enabled
Save and Save & Close buttons are not visible.
Hope this helps.

--
Happy CRM'ing

Gopinath

Thursday, 10 March 2016

Import Data button is not visible in CRM 2011/2013/2015

Hi,

Today we have observed for one of the users in CRM Import Data button was not visible.
We did check the security role and I feel that all the security role were given properly. Normally for users who have the base role we don't give delete permission on any entity.

Here is the link which explains the basic permissions needed for importing data into CRM.

Basic Security Role Privilege for Data Import in CRM

After some search came to know that we need to give User level Delete Privilege on Data Import and Data Map. This is the minimum delete privilege to be given in order to Import data into CRM where Record Deletion is not entertained.

After making below change, Import Data button is shown on the ribbon.
Set the Privilege at the user level first and then move to the Organization level as per the requirement.

Hope this helps.

--
Happy CRM'ing

Gopinath

Opportunity Sales Team - Access Team in CRM 2013/2015

Hi,

We all know that Access Teams was the new feature in CRM 2013. Today I was working on Access Team where I have added a sub grid on the Form with the following properties.
 
Just before adding I have seen a OOB sub grid with name connections and did search on it. To my wonder, I found that adding the records to the connections internally adds the same user to Access Team which means we don't any more new sub grid.
 
I have added new Sub Grid as per the above screen shot.
 
1) Two sub grids a) Sales Team (Connections OOB) b) Access Team Member (Custom Sub grid which was added by me)
2) Added a user in the Sales Team (Connections OOB)

3) Refresh the page, you will see the same user has been added in the Access Team which means we don't need to add any new sub grid on the Opportunity to give access to the users.
Hope this helps.
 
--
Happy CRM'ing

Gopinath

Tuesday, 8 March 2016

Run To Cursor in Visual Studio

Hi,

I was sitting in front of lap where Visual Studio is opened and right clicked and selected Run To Cursor. Immediately my application did build and started running and stopped on the line where I select Run To Cursor. Thought this is really cool feature and wanted to share this.

Run to cursor is a great and hidden features. Instead of doing step by step debugging, we can directly start debugging where we need to stop. It is just like a breakpoint in fact it is better than breakpoint. When we select the run to cursor option, Visual Studio start the debugger automatically and execution stops to the selected line.


Short cut for it is CTRL + F10

Hope this helps.

--
Happy Coding

Gopinath

Set Focus using JavaScript in CRM

Hi,

Today I was working on validating some fields on the form and showing a message to the user to enter the data.

Normally whenever we do the validation, its always better to set the focus to the required field you are pointing out instead giving the pain to the user to search for it.

Here is the JavaScript code to set the focus to the field.

Xrm.Page.ui.controls.get("AttributeName").setFocus();

--
Happy CRM'ing

Gopinath

Wrong type of attribute UI properties passed to the attribute


Today when are trying to Merge got below error message and there is no log file also to download. Disabled all the plugins, JavaScript on Account entity and tried again but the same error message popped up.

Hence confirmed that there is something other than plugins and custom JavaScript. Went ahead started debugging the OOB JavaScript on Merge button click and got the below error message.
Wrong type of attribute UI properties passed to the attribute "attribute name"

Then understood the problem, we have created a custom field with Whole Number as a datatype and then we realized that the field should be of type Two Options. We have deleted the field and created the field with the same schema name.

Solution
1) Remove the field on the form.
2) Save and Publish the form.
3) Add the field back on the form.
4) Save and Publish the form.


Note - I would recommend to not to delete the fields and create again with the same schema. We never know where will it hit us back. Better set the Searchable property to No to the old field and rename it to Do Not Use and create a field with new schema name.

--
Happy CRM'ing
Gopinath