InvalidPluginExecutionException dialog does not show up - CRM 2011 - dynamics-crm-2011

I have a Plugin on the Creation, Updating, and Deletion of the OpportunityProduct entity in the CRM 2011. I want to through exception on the success of some operations, means want to display dialog. It is working fine for Update and Delete. But it is not working fine for the Creation of OpportunityProduct, it is not throwing exception in the dialog. It is showing Exception: “An error has occurred, Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solution or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.”
Message : Create
Primary Entity : opportunityproduct
Action: Pre-Operation
Execution Mode: Synchronous

I think this is an internal issue that relates to how CRM treats compound entities such as opportunity product.
To verify this behavior you should put breakpoint in your code and inspect the context depth and parent context to understand if the create event is indeed a child process or the opportunity.
If so you might be able to re-register the plug-in the opportunity and try to somehow throw the error from there.

Related

Dynamics CRM suppress record unavailable exception

Is there a way to suppress/handle the "Record Unavailable" exception using a plugin/JavaScript. When a user tries to open a record that no longer exists,
I want implement a custom process to proceed. We are using Dynamics CRM 365.
Thanks in advance
Implemented a workaround using a similar approach outlined in this article. Essentially, I check to see if the record exists in the retrieve message and then trigger a custom action if it did does not exist anymore i.e recreate the record.
https://ameedsheikh.wordpress.com/2015/08/24/integrate-lob-data-details-in-crm-without-loading-large-data-volumes/#comment-178

CRM 2013 Migration: Custom entity form issues

We have migrated to CRM 2013 from CRM 2011. we are facing the following issues post Migration.
Onload of one of the custom entity form, it was giving error in the internal javascript(JsProvider.ashx).
Error-Line: 2
Error: Object doesn't support property or method 'get_disabled'
And also noticed that While saving the form customization of the same entity getting error permission denied. The error was on the line window.top.opener.auto(Mscrm.EntityTypeCode.SystemForm).
Couldn't understand why this is happening? The user has Administrative privileges. Have anyone faced this kind of issue?
Note- THis entity has multiple forms and this issues are happening only with two forms.
Seems like a compatibility issue for the forms. Were they imported from CRM 2011? In that case you can open a support case with MS or recreate them using the CRM 2013 GUI.

AddMembersTeamRequest in Plugin - Privilege Delay

This is Dynamics CRM 2011 Rollup 11 On-Premises with SQL 2008 R2
Have the following scenario that we're trying to debug:
In a Synchronous PostCreate plugin we add users to a Team that owns a specific record and has read permission on that record via a security role. That should mean that when the Create process is completed the users added to the Team have access to the record. When such a user then goes to open the record they get a SecurityException ReadAccess error. The record does show in grids, which should not happen if they do not have Read permission on the record.
As a further test we execute the SDK call RetrievePrincipalAccessRequest for the user and record, from a console application, and see that the user does not have Read permission.
We can look a the Team Member list in the UI and user is a member of the Team. If we wait long enough (and create another record the issue will eventually resolve itself - several minutes later.)
We can add a user to the team, using the same code we executed in our Plugin (but running in a console app), and the user has Read permissions and can access the record immediately after the call completes.
There is clearly something going on in our Plugin that is causing an issue but we cannot figure out what or why - since the Create call completes without error and we can see the user listed in the UI. We are not doing anything funky - i.e., direct SQL, external service, etc.
We call a standard CRM 2011 SDK message and it completes without throwing an error. We can validate that the user was added in the user interface. The user have permission to Read the entity but they do not.
Any thoughts/ideas?? We've been tracking like crazy but haven't found our smoking gun!
UPDATE
We can reduce the incidence if you we put a pause in our plug-in code. This error only occurs when the add is done during a plug-in, not when it is done outside the plug-in. I'm starting to wonder if there is a SQL procedure/statement (there are three stored procs that fire when a user is added to a team) that gets cut short or fails to complete, for one reason or another, since the add is successful when not done in plug-in code.
Finally found the answer in the list of items resolved by Rollup 18 (http://support.microsoft.com/kb/2958724)
If You are assigning Team Membership via plugin, the user Cache does
not get invalidated, causing an error when trying to retrieve a
record. The issue occurs if the Team is has a security role and Access
Rights are controlled via Team ownership.
We had opened a ticket about 2 months ago with Microsoft which had involved a lot of back-and-forth but not a definitive fix.
So if you experience the same issue on CRM 2011 you need to update to Rollup 18.

How do I safely add an attribute to an Opportunity?

I am building a plugin that utilizes the new Business Process Flow in Dynamics 2013, and in order to take full advantage of the easy to use check-list style menu I have added two new attributes to the default Opportunity entity in Dynamics CRM.
I have done this in the plugin's customizations.xml file by adding the attributes to the Opportunity Entity under the EntityInfo->Entity->Attributes section of the Entity xml.
The addition of this field to the Opportunity works just as expected, though I am running into issues when uninstalling the plugin.
Since this plugin will be widely available, I can't expect users to keep it on their systems forever.
On uninstallation of the plugin, however, Opportunities can no longer be viewed in the CRM 2013 Online. When I try to view one I get the following:
Critical
Query Builder Error
The specified field does not exist in Microsoft Dynamics CRM
Is there something I can do within the customizations.xml file to ensure that once the plugin solution has been uninstalled, Dynamics CRM will no longer reference these fields?
note: This issue occurs on a brand new instance of Dynamics CRM 2013 (trial) with the plugin simply installed / uninstalled, so no other customizations are linking to changes from the plugin and causing the crash
If you were to make this change via the UI, it would block you from deleting these fields until all dependencies have been removed as well. Because you chose to do this without the assistance of the UI, it is breaking on you. If you go back and make this change via the UI, the customizations.xml file should be properly updated and you should be good to go (or it will error and say where there is still a dependency - making it easy to go and fix it).

Error When Creating Record from Related Entity

I have a custom entity related to Account.
When I create a record of the custom entity from the Account an error message is shown:
Error
An error has occurred....
If this continues, contact your system administrator.
There is no problem creating the record from the entity itself.
There is a JavaScript function registered on-save of the custom entity that prevents the save if the record is a duplicate.
Why does the create/update not work from the related Account?
Although I agree with #PedroAzevedo's idea to turn tracing on, I disagree with his method because the CRM Diagnostic tool is a lot easier: http://crmdiagtool2011.codeplex.com
I'd also check for a plugin registered on the update of the Account Entity. It may be failing there, which would account for why it does work on the entity form itself...
Active the trace and see full error description. Another thing you can check is the security role, if you have permissions for the action AppendTo at Account.
The problems is IE 10. I installed Windows 8 last night and do not yet have update rollup 12 installed.
The same error occurs when I try to add a contact to the Account.

Resources