Hi all
This is the scenario:
- Create record of type entityA.
- Fire synchronous plugin on post-op of entityA Create message and attempt to associate other entities of type entityB to itself (for simplicity, let's make it a single record).
- Associate message fires pre-op plugin - this plugin checks whether entityB record can be associated to entityA record based on predefined criteria and throws an Exception if not.
To do step 3, I need to read fields from the entityA record, but whether I try to use the localContext.OrganizationService or try creating a new IOrganizationService using the (IOrganizationServiceFactory)localContext.ServiceProvider.GetService(typeof(IOrganizationServiceFactory)).CreateOrganizationService(context.UserIdcontext.UserId)
I get SQL timeouts on the retrieve. I'm guessing this is a lock issue, since entityA record is still in the transaction from it's Create message? How do I read the values in?
P.S. I tried adding the entity to both the ShareVariables and the InputParameters and OutputParameters but the key isn't in any of those dictionaries when I enter the pre-op Associate plugin.
P.P.S. I've also tried running in both Sandbox and None modes.
Any help would be very much appreciated.
Thanks
James