I am trying to register a plugin on the Associate message for two entities with a many to many (N:N) relationship
When I try and create a new step in the plugin registration tool I get the following error:
"Invalid Primary Entity or Secondary Entity specified. Plese re-enter the data"
I am trying to register against the Quote (quote) and a custom entity (new_equipment).
Can you not specify the primary / secondary entities within the tool?
Do I have to check the entities within code?
How would I do this?
What does the context object look like when dealing with intersects?
It seems "Associate" message is not available to register with Plugins. I have checked with "message-entity support for plug-ins.xlsx" file which comes with SDK. It has "NULL" values for both "PrimaryEntity" and "RelatedEntity" fileds which means we can't register "Associate" message with any of the entities.
Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"
- Proposed as answer by VishalSwamiMicrosoft employee Monday, April 25, 2011 10:21 AM
If I am in a Quote (quote) and associate an existing Equipment record (new_equipment), the Target object is the new_equipment entity reference.
Can I use the Context object to get the GUIDs of both entities?
How do I get a reference to the Quote entity?
Did you find an answer to this: I am looking into this now.
I think you can get the related entities by doing a retrievemultiplerequest on an sdkmessagerequestentity by the guid presented in your pluginexecutioncontext.requestid property.
The sdkmessagerequest entity has a related entities property. You should be able to iterate through these to get any info you want about the related entities, including information you would use to filter. You could make sure for instance that there was both an entity with LogicalName of "account and one with logicalname = "contact" to determine if the associate request was between those two types before executing other actions.
The relatedentity enumerated objects should also have all the other properties of those entities (including Guids you could use to act on those objects).
I can help you further on this one if you like.
Follow Me on Twitter!