Monday, February 22, 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, February 19, 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, February 9, 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, February 8, 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, February 7, 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, January 30, 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, January 26, 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

Ribbon Workbench Processtrigger With Id = Does Not Exist Issue in CRM

Hi,

Today we got a requirement to hide one of the buttons on Task entity based on some business rule. I have imported Ribbon workbench solution and open the Task entity using Ribbon Workbench. After I am done with the customizing the command, clicked on Publish solution. It took some time and thrown a popup saying the below message.

"Processtrigger With Id = Does Not Exist Issue"

Before it was working fine. I went here and there but could not find anything in CRM. I just recalled the customizations we did on it and some other things we did. Then I realized that recently we have upgraded our CRM to update 0.2.
And found that there was some issue with Customization import where we have business rules.


The quick work around is by changing the scope of Business Rules to "All Forms" resolved the issue.

An issue has already been raised with the Product Team, unfortunately we need to wait until Update 0.3 for the fix.

Hope this helps.

--
Happy CRM'ing

Gopinath

Sunday, January 24, 2016

Remove Locked Field in the Header

Hi,
 
Today, I got a business requirement to remove the Effective from and Effective to fields from the header of the quote.
 
First, I thought that would be very simple to do and opened the Quote form. And noticed that those fields are Locked fields.
 
The work around is very simple.
Add the locked fields on the form. In this case, Effective from and Effective to.

Open the Properties of the field and uncheck Visible by default.

Select the Header on the ribbon and now you will be able to remove the locked fields from the header. You can add the fields as per your requirement.
 Hope this helps.
 
--
Happy CRM'ing

Gopinath

System.InvalidCastException: Unable to cast object of type ‘Microsoft.Xrm.Sdk.Entity’ to type

Hi,
 
Today suddenly all our plugins where we are using early binding thrown exception saying the below message.
 
Unable to cast object of type ‘Microsoft.Xrm.Sdk.Entity’ to type
 
After sometime, fixed the issue by adding the below line in AssemblyInfo.cs of the plugin project.
 
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute]

Hope this helps.
 
--
Happy CRM'ing

Gopinath

Saturday, January 9, 2016

Plugin on Merge message in CRM

Hi,
 
Recently, we had a to write a plugin on merge message in CRM. We need to perform some activity based on merged records(Master and Subordinate).
 
Here is the C# code to get the Master and Subordinate entity reference in the plugin code.
 
if (pluginContext.InputParameters.Contains("Target") && pluginContext.InputParameters["Target"] is EntityReference)
{
       EntityReference entityReferenceMaster = (EntityReference)pluginContext.InputParameters["Target"];
       Guid guidSubOrdinate = (Guid)pluginContext.InputParameters["SubordinateId"];

       // Get Master record information. Specify the attributes which you want to retrieve
       Entity entMasterAccount = crmService.Retrieve("account", entityReferenceMaster.Id, new ColumnSet(new string[] {  }));

       // Get Subordinate record information. Specify the attributes which you want to retrieve
       Entity entOrphanAccount = crmService.Retrieve("account", guidSubOrdinate, new ColumnSet(new string[] { }));
}

Hope this helps

--
Happy CRM'ing
Gopinath

Changing security attributes is not allowed in stage 20 plugins

Hi,

Recently we were working on setting Owner of the record in the Pre-Create of the plugin based on our business rules. When we were testing we got the below message. I remember that we did the same in CRM 2013 which used to work properly, some how it is not working in CRM 2015 RTM.

Changing security attributes is not allowed in stage 20 plugins

Moved the code to trigger on Post-Create operation and written a code for assigning a record.

Hope this helps.

--
Happy CRM'ing

Gopinath

Sunday, January 3, 2016

Minimum privileges required to access CRM application

Hi,
 
Today we have a created a new security role in CRM and faced issues when we assigned it to the users.
 
Here is the list of minimum privileges required to access CRM application
 
Entity NamePrivilege(s)   Access LevelSecurity role “Tab” Name
User Entity UI SettingsCreate, Read, WriteUserCore Records
User SettingsReadUserBusiness Management
CustomizationsReadOrganizationCustomization
System FormReadOrganizationCustomization
ViewReadOrganizationCustomization
Web ResourceReadOrganizationCustomization
  • To render the Home page: prvReadWebResource, prvReadCustomization
  • To render an Entity grid (that is, to view lists of records and other data): Read privilege on the entity, prvReadUserSettings, prvReadQuery
  • To view single Entity in detail: Read privilege on the entity, prvReadSystemForm,  prvCreateUserEntityUISettings, prvReadUserEntityUISettings
Hope this helps.
 
--
Happy CRM'ing
Gopinath

Principal user is missing prvReadQuery privilege

Hi,

We have a created a new security role in CRM and given access as per our requirement. When I started testing by assigning the same security role one of the users got the below exception.

Principal user is missing prvReadQuery privilege

This is shown as there is no read permission to the View in the Customization tab.

Hope this helps.

--
Happy CRM'ing

Gopinath

Friday, January 1, 2016

Custom Workflow Input and Output Parmeters in CRM

Hi,
 
Today I got a requirement to create a task and assign it to the Manager of the Owner on the Parent Record. We can easily get the Owner value in the system workflow but not the Manager of the owner.
 
For this I had to write a custom workflow which will take Owner value as an Input Parameter and returns Manager of the Owner as an Output Parameter.
 
Here is the way to declare Input and Output Parameter in a Custom Workflow.
 
/// <summary>
/// Input Argument - SystemUser
/// </summary>
[RequiredArgument]
[Input("User")]
[ReferenceTarget("systemuser")]
public InArgument<EntityReference> User { get; set; }

/// <summary>
/// Output Arugument - Manager of the user.
/// </summary>
[Output("Manager of the user")]
[ReferenceTarget("systemuser")]
public OutArgument<EntityReference> Manager { get; set; }

And this the below code in the Workflow Execute Method.

// Get the Manager of the user.
EntityReference erfUser = User.Get<EntityReference>(executionContext);
Entity entityUser = service.Retrieve("systemuser", erfUser.Id, new ColumnSet(new string[] { "parentsystemuserid" }));
Manager.Set(executionContext, (EntityReference)entityUser.Attributes["parentsystemuserid"]);

After this, just build your project and deploy it in CRM and use the same in the system workflow by passing the Owner value and it will give the Manager of the owner.

In the same way, we can using CRM Custom Workflow for many business operations by using Input and Output Parameters.
 
Hope this helps.
 
--
Happy CRM'ing
Gopinath

Unshare Record in CRM using C#

Hi,

Here is the code for un sharing record in CRM using C# code.

/// <summary>
/// Un shares the Record from Team or User.
/// </summary>
/// <param name="service">CRM Organization Service</param>
/// <param name="erfTargetEntity">Target Entity Reference</param>
/// <param name="erfTeamOrUser">Team or User Entity Reference</param>

public void UnShareRecord(IOrganizationService service, EntityReference erfTargetEntity, EntityReference erfTeamOrUser)
{
       ModifyAccessRequest modif = new ModifyAccessRequest();
       modif.Target = erfTargetEntity;
       PrincipalAccess principal = new PrincipalAccess();
       principal.Principal = erfTeamOrUser;
       principal.AccessMask = AccessRights.None;
       modif.PrincipalAccess = principal;
       ModifyAccessResponse modif_response = (ModifyAccessResponse)service.Execute(modif);
}

Refer this link for sharing record.

Hope this helps.

--
Happy CRM'ing
Gopinath