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

Monday, 22 February 2016

You do not have permissions to see this view. Contact a system administrator on What's New - CRM 2015/2016

Hi,

Today we have observed for one of the users in CRM What's new section is not loading properly and it was showing the below error.

You do not have permissions to see this view. Contact a system administrator.
 
For fixing the issue, we need to give privileges on

1) At least User level Read rights on Filter
2) Organization level Read rights on Post Configuration


Without giving this, you may receive the above error but clicking on the Refresh symbol on the What's New section should still allow you to view the records strange but true.

--
Regards,
Gopinath

Friday, 19 February 2016

Plugin on Re-Open Opportunity in CRM

Hi,

Today I got a requirement to do some business logic when re-opening the opportunity. First of all, I thought writing a plugin and having pre-image to compare the state or status reason. Again I just checked the plugin messages on the opportunity as Won, Lost, SetState and SetStateDynamicEntity.

To trigger the plugin on Reopen the opportunity, we need to register the plugin on SetState or SetStateDynamicEntity. Won triggers when we won the opportunity and Lost when we close the opportunity as Lost.

Hope this helps.

--
Happy CRM'ing
Gopinath

Tuesday, 9 February 2016

SharePoint solution activate button is disabled

Hi,

Today we are working on integrating CRM with SharePoint. As we all know if we need to upload list component in SharePoint and activate it. When I tried upload, observed that the Activate button is disabled even though I logged in as Admin.

The problem is that "SharePoint User Code Host" service was disabled which was of course due to the "Microsoft SharePoint Foundation Sandboxed Code Service" being Stopped (or probably in this case just never started to begin with).

To start the service, navigate to Open Central Administration--> System Settings --> Manage Services on Server and start "Microsoft SharePoint Foundation Sandboxed Code Service".
 
Hope it helps.

--
Happy CRM'ing
Gopinath

Monday, 8 February 2016

Missing prvReadComplexControl privilege in CRM

Hi,
 
Recently, we have created a new security role in CRM and given the same to the users. When I was testing suddenly an error came up throwing the below message.
 
Principal user (Id=37bb181a-da66-446e-9ef7-7c078b76ef7e, type=8) is missing prvReadComplexControl privilege.
 
I never heard about Complex Control in CRM, after a little bit of search came to know that we need to give read permission on Process Configuration entity under Customization tab.
 
After a quick search on MSDN, it is clearly as mentioned as below
 
"This entity is for internal use only. However, users need read access to this entity in order to see the updated experience for lead and opportunity forms."

So make sure you give the read access on Process Configuration for the newly created roles.

--
Happy CRM'ing

Gopinath

Plugin Stages - Pre Validation, Pre Operation and Post Operation

Hi,
 
Here is short description about the stages in Plugin.
 
Pre Validation - Plug-ins registered in this stage may execute outside the database transaction. Registered Plug-in run before the form is validated. It is useful if you want to implement business logic before the actual validation starts.  i.e., Changes made in plug-in won’t be saved if the validation of the main system plugins complain because the changes are outside the database transaction.
 
For example - Deletion cascades happen prior to pre-operation, therefore if you need any information about the child records, the delete plugin must be pre-validation.
 
Pre Operation - Plug-ins registered in this stage are executed within the database transaction. In simple words, After validation and before saving the values in database.
 
Post Operation - Plug-ins registered in this stage are executed within the database transaction. Plugin will run after the values have been inserted/changed on the database

For more information check this Stages, Stages Number and their use in CRM Plugins

--
Happy CRM'ing
Gopinath

Sunday, 7 February 2016

missing prvReadAsyncOperation privilege

Hi,

Today one of my plugins thorown an exception with the below message.

"Principal user (Id=GUID, type=8) is missing prvReadAsyncOperation privilege"

We have created a secuirty role  and we forgot to grant Read Privelige to System Job for the security role.

Giving Read access on the System Job entity fixed the issue. Refer the below screen shot for your reference.
Hope this helps.
--
Happy CRM'ing

Gopinath

Saturday, 30 January 2016

This bundle can't be published because it has too many properties. A bundle in your organization can't have more than 50 properties

Hi,

Today I was working with Product Configuration in CRM. We have created properties under family and the same family as parent for creating bundles. When we publish the bundle, we have received the below exception with the following message.

"This bundle can't be published because it has too many properties. A bundle in your organization can't have more than 50 properties."


This limit can be increased in System Settings.

Open System Settings --> Sales

Hope this helps.

--
Happy CRM'ing

Gopinath

Tuesday, 26 January 2016

Disable all fields on a Web form (ASP.net, HTML forms)

Hi,
 
Today we got a requirement to disable all the fields on the ASP.net form based on some conditions.
 
This can be easily done using JavaScript. Here is the code for it.

var inputs = document.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
     // For applying background color and color.
     // inputs[i].style.backgroundColor = "#9fd4fe";
     // inputs[i].style.color = "black";
     inputs[i].disabled = true;
}
var selects = document.getElementsByTagName("select");
for (var i = 0; i < selects.length; i++) {
     selects[i].disabled = true;
}
var textareas = document.getElementsByTagName("textarea");
for (var i = 0; i < textareas.length; i++) {
     textareas[i].disabled = true;
}
var buttons = document.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
     buttons[i].disabled = true;
}
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
     links[i].disabled = true;
}

Hope this helps.
 
--
Happy Coding

Gopinath