Cannot Throw Plugin Exception when Create OpportunityProduct after update rollup 10
-
Friday, September 21, 2012 2:35 AMHi All:
I use CRM 2011, after update rollup 10.
I cannot throw any exception message in plug-in when create opportunityProduct,
the system exception message is not my expect..
Please give me a hand.
ps1: registration message:Create, Eventing execution: pre-operation or post-operation.
ps2: there is the same problem when create QuoteDetail.
---- code ----
namespace TestPlugin
{
public class postCreateOpportunityProduct:IPlugin
{
public void Execute(IPluginExecutionContext context)
{
throw new InvalidPluginExecutionException("Test_123");
}
}
}
---- system message ----
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 2012/9/19 上午 09:37:14
Event time (UTC): 2012/9/19 上午 01:37:14
Event ID: daaad4c7c7fc44ab9db2a9e139a8ecbd
Event sequence: 1501
Event occurrence: 5
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2/ROOT-2-129924429761542445
Trust level: Full
Application Virtual Path: /
Application Path: C:\Program Files\Microsoft Dynamics CRM\CRMWeb\
Machine name: KST
Process information:
Process ID: 3040
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: ArgumentException
Exception message: Invalid state code
at Microsoft.Crm.Application.Platform.OpportunityProduct.SetDisabled()
at Microsoft.Crm.Application.Forms.AppForm.RestoreEntity(EntityProxy entity, String changedFormData, String savedData)
at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)
at Microsoft.Crm.Application.Forms.AppForm.Save(Boolean& gridRefreshCallbackAdded)
at Microsoft.Crm.Application.Forms.AppForm.FormSaveEvent()
at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, FormDescriptor fd)
at Microsoft.Crm.Application.Components.PageHandlers.OpportunityProductRecordPageHandler.ConfigureFormHandler()
at Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName)
at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Request information:
Request URL: http://10.10.1.1:80/[OrgName]/userdefined/edit.aspx?_CreateFromId={BC98D217-4CFE-E111-9E71-005056AF0035}&_CreateFromType=1084&etc=1085&pagemode=iframe&preloadcache=1348018623167
Request path: /[OrgName]/userdefined/edit.aspx
User host address: 10.10.1.1
User: [AD]\crmadmin
Is authenticated: True
Authentication Type: Negotiate
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 41
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at Microsoft.Crm.Application.Platform.OpportunityProduct.SetDisabled()
at Microsoft.Crm.Application.Forms.AppForm.RestoreEntity(EntityProxy entity, String changedFormData, String savedData)
at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)
at Microsoft.Crm.Application.Forms.AppForm.Save(Boolean& gridRefreshCallbackAdded)
at Microsoft.Crm.Application.Forms.AppForm.FormSaveEvent()
at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, FormDescriptor fd)
at Microsoft.Crm.Application.Components.PageHandlers.QuoteDetailRecordPageHandler.ConfigureFormHandler()
at Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName)
at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
All Replies
-
Tuesday, October 16, 2012 11:09 AM
Hi,
I had the same error when trying to save an opportunity product. I've customized our Opportunity Product form quite substantially to remove all references to 'default pricing' (as everything we do has custom pricing). When logged in as a system admin it worked and saved as expected, however other users encountered the exact same error you posted.
In my case it turned out that it was missing permissions (prvOverridePriceEngineOpportunity 'override opportunity pricing' privilege) that was causing this exception. I discovered this by turning on tracing on the server using http://crmdiagtool2011.codeplex.com . The section directly above the 'invalid state code' argument exception lead me to the missing permission. See the excerpt from my trace logs below.
Hope this helps,
Alex
[2012-10-16 11:44:53.076] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 13 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 1d953aca-302b-4de0-8e41-8f006ca0c84a | CrmException..ctor ilOffset = 0x0
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException) ilOffset = 0x0
at CrmException..ctor(String message, Int32 errorCode) ilOffset = 0x0
at PlatformCommand.CreateCrmExceptionFromServiceFault(FaultException`1 fe) ilOffset = 0x1B
at PlatformCommand.XrmExecuteInternal() ilOffset = 0xF6
at CreateCommand.Execute() ilOffset = 0xC
at EntityProxy.Create(Boolean performDuplicateCheck, Guid auditingTransactionId) ilOffset = 0x0
at EntityProxy.Create(Boolean performDuplicateCheck) ilOffset = 0x0
at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck) ilOffset = 0x28
at AppForm.Save(Boolean& gridRefreshCallbackAdded) ilOffset = 0x47
at AppForm.FormSaveEvent() ilOffset = 0xD
at AppForm.RaiseDataEvent(FormEventId eventId) ilOffset = 0xCD
at EndUserForm.Initialize(Entity entity) ilOffset = 0x1F
at CustomizableForm.Execute(Entity entity, FormDescriptor fd) ilOffset = 0x62
at OpportunityProductRecordPageHandler.ConfigureFormHandler() ilOffset = 0x69
at GenericEventProcessor.RaiseEvent(String eventName) ilOffset = 0x2D
at PageManager.OnPreRender(EventArgs e) ilOffset = 0x53
at Control.PreRenderRecursiveInternal() ilOffset = 0x54
at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x69E
at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x3C
at Page.ProcessRequest() ilOffset = 0x14
at Page.ProcessRequest(HttpContext context) ilOffset = 0x31
at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() ilOffset = 0x11D
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ilOffset = 0x15
at ApplicationStepManager.ResumeSteps(Exception error) ilOffset = 0x10E
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) ilOffset = 0x5C
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) ilOffset = 0xFC
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType) ilOffset = 0x45
>Crm Exception: Message: Principal user (Id=0afe405a-f006-e211-adc1-005056b466c3, type=8) is missing prvOverridePriceEngineOpportunity privilege (Id=0fe2f754-3531-4670-8a8d-b3d7eb49321e), ErrorCode: -2147220960
[2012-10-16 11:44:53.076] Process: w3wp |Organization:99c3262a-653c-e111-a5b8-005056b30037 |Thread: 13 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 1d953aca-302b-4de0-8e41-8f006ca0c84a | ErrorInformation.LogError ilOffset = 0x17
>MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Error Message: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Error Details: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source File: Not available
Line Number: Not available
Request URL: http://crmserver/org/userdefined/edit.aspx?_CreateFromId=%7bDCBDC41C-6D17-E211-B313-005056B466C3%7d&_CreateFromType=3&etc=1083&pagemode=iframe&preloadcache=1350384274764
Stack Trace Info: [ArgumentException: Invalid state code]
at Microsoft.Crm.Application.Platform.OpportunityProduct.SetDisabled()
at Microsoft.Crm.Application.Forms.AppForm.RestoreEntity(EntityProxy entity, String changedFormData, String savedData)
at Microsoft.Crm.Application.Forms.AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)
at Microsoft.Crm.Application.Forms.AppForm.Save(Boolean& gridRefreshCallbackAdded)
at Microsoft.Crm.Application.Forms.AppForm.FormSaveEvent()
at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, FormDescriptor fd)
at Microsoft.Crm.Application.Components.PageHandlers.OpportunityProductRecordPageHandler.ConfigureFormHandler()
at Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName)
at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)- Edited by AlexMarshall Tuesday, October 16, 2012 11:10 AM
- Proposed As Answer by AlexMarshall Tuesday, October 16, 2012 11:10 AM
-
Wednesday, November 14, 2012 3:12 PM
-
Wednesday, February 06, 2013 6:01 PM