CRM 2011: Hitting Save Quote does not do anything, record not saved

Problem:
As described in the subject line, when user hits the Save/Save & Close button, nothing happens. Quote records are not saved, not even a post back happens when hitting save. We checked all different scenarios and nothing worked as Save event was not triggered.

Configuration:
Users/Team were assigned OOB “Sales Person” roles.
Entity: Quote

Resolution:
Give Product entity a full access to the security role and check saving again. It should work.

Advertisements

XrmToolBox – A Must have tool for CRM/XRM Developers

If you are a seasoned CRM/XRM developer, you must have heard about XrmToolbox. If you have, you can simply ignore this post. BUT if you have not then you MUST read on.

This post is about XrmToolbox (http://www.xrmtoolbox.com/) and its plugins which can improve your efficiency and accelerate overall development speed. I intend to list all the default plugins and provide more details on plugins as and when time permits. So here is a list of plugins which gets installed by default.

 

Continue reading on: XrmToolBox – A Must have tool for CRM/XRM Developers

The Microsoft CRM Email Router service on Local Computer started and then stopped

The Microsoft CRM Email Router Service will not start every time you start it manually from Services and throws an error message “The Microsoft CRM Email Router service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.”

Event log entries say:
Event Type: Error
Event Source: MSCRMEmail
Event Category: None
Event ID: 0
Date:
Time:
User:
Computer:
Description:
#16192 – The E-mail Router service could not run the service main background thread. The E-mail Router service cannot continue and will now shut down. System.Configuration.ConfigurationErrorsException: The E-mail router service cannot access system state file Microsoft.Crm.Tools.EmailAgent.SystemState.xml. The file may be missing or may not be accessible. The E-mail Router service cannot continue and will now shut down. —> System.Xml.XmlException: Root element is missing.

This means your Email Router configuration file is corrupted.

You need to go to C:\Program Files\Microsoft CRM Email\Service and delete the Microsoft.Crm.Tools.EmailAgent.SystemState.xml file. Try to re/start the Email Router Service. This should resolve your problem.

CRM 2013: Email Router: The message exceeds maximum supported size

If your email router does not process any emails but your inbox from Email Provider works just fine!?! Check event logs where Email Router is installed. You might see many repeated errors similar to mentioned error here below:

#27938 – An error occurred while checking for email messages to process in mailbox service@gmail.com. Microsoft.Crm.Tools.Email.Providers.EmailException: Error: The message exceeds the maximum supported size.
at Microsoft.Crm.Tools.Email.Providers.ExchangeWSConnector.LogEwsResponseErrorWarning(String message, ResponseClassType responseClassType)
at Microsoft.Crm.Tools.Email.Providers.ExchangeWSConnector.RetrieveMessage(ArrayList ids, Int32 index, ServiceLogger serviceLogger)
at Microsoft.Crm.Tools.Email.Providers.ExchangePollingMailboxProvider.RetrieveNextMessageInternal()
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.RetrieveNextMessage()
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.Run()

Check your inbox for the emails with attachments. Find emails with more than expected attachments size per email, take backup (if required) and delete them. Your Email Router should work just fine once this is done!

In my case an email with 100+ MB attachment size was creating an issue.

Happy Troubleshooting!!

CRM 2013: Cannot specify child attribute retrieve – MergeRequest C#

Hello!

If you are working on code to merge two entity records and come across “Cannot specify child attribute retrieve” error; and you have referred SDK/MSDN documentation. You probably have kept UpdateContent property optional and havent set it. UpdateContent is a required property though the documentation says it is not.

This property is optional in case of merging incidents only.

You just have to set Entity object to UpdateContent property which has attributes to be updated to the merged record.

Entity contact = new Entity("contact");
contact["firstname"] = "Crm";
contact["lastname"] = "Xpress";
 
// merging contact records
MergeRequest merge = new MergeRequest
{
    // SubordinateId is the GUID of the contact merging.
    SubordinateId = contactId,
    Target = target,
    PerformParentingChecks = true,
    UpdateContent = contact // Entity Object to set the content you want updated on the merged contact
};

HTH!
Happy Merging!

C#: Security accessibility of the overriding method must match the security accessibility of the method being overriden

I was porting a .Net 2.0 assembly to .Net 4.0 plugin assembly and faced this particular challenge.

The project had a test app(A WinForm app) and it worked fine on the desktop but when I deployed the logic on server to run as a plugin it gave the following error

xyz..GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Just notice, the spelling for “overridden” is also not correct. But this is what .Net framework threw.
After some research I found that this behavior is “By Design” i.e. as per security transparency model defined in .Net v4.0. It basically has two models:
1. Level1 (High Level) for v2.0
2. Level2 for v4.0
Here is a a list of critical operations:

1. Call native code

2. Contain unverifiable code

3. Call critical code

4. Perform security asserts

5. Satisfy link demands

6. Derive from non-transparent types

7. Override security critical virtuals

And only full trust code can be security critical.

Hence an overridden member should have the same security accessibility (Critical, Safe Critical or Transparent).
To resolve this error take the following step:
Go to the AssemblyInfo.cs class to your project and add following attributes to it. And this should resolve the exception.

[assembly: SecurityRules(SecurityRuleSet.Level1)] 
[assembly: AllowPartiallyTrustedCallers]

I believe it might be helpful to many as there are lot of Dynamics CRM implementations being upgraded.

Reference links to the differences between both and transparency rules:
http://blogs.msdn.com/b/shawnfa/archive/2009/11/12/differences-between-the-security-rule-sets.aspx
http://blogs.msdn.com/b/shawnfa/archive/2009/11/03/transparency-101-basic-transparency-rules.aspx

CRM 2011: Object address not found on party or party is marked as non-emailable

While sending an Email message from either workflow/plugin or through sdk, if you get this message – “Object address not found on party or party is marked as non-emailable”; check below things:

  1. Check if the record is contact and the records is allowed for Emails or Bulk Email. These are Options available on Contact records and you can set them individually. Make sure both has Allow selected on contact.
  2. Check if your contact records is having a valid email address and not having blank value.

Happy Troubleshooting!!

CRM 2011, JavaScript: Set Customer Type of Lookup

Lets say you have to set Customer type of Lookup from JavaScript. Here is the code! You just have to set another attribute and you’re done!

Here I have given it in parameters as I had to open form with these parameters auto filled.

var params = {};
params["customerid"] = Xrm.Page.getAttribute("customerid").getValue()[0].id;
params["customeridname"] = Xrm.Page.getAttribute("customerid").getValue()[0].name;
params["customeridtype"] = Xrm.Page.getAttribute("customerid").getValue()[0].entityType;

//Open a new account record
Xrm.Utility.openEntityForm("incident", null, params);

Hope it helps!

CRM 2011, JavaScript: How to add some action after save record?

Hi there!

I recently had a requirement where I had to save the record and open another form once the button is pressed from ribbon.

I added the save JavaScript to the web resource and call it and call other function to open the form. This was not working for me.

Resolution for this:

Add an event on Save action by:

Xrm.Page.data.entity.addOnSave(openAccountForm); // openAccountForm is another function which opens the form
Xrm.Page.data.entity.save();
function openAccountForm() {
    Xrm.Utility.openEntityForm("account");
}