Need Help Writing Plug-In RRS feed

  • Question

  • I need some help writing a pug-in to address the following:

    We have a custom entity (A) that has a 1:N relationship with a child entity (B).  Entity B has an Option Set field where one of the options is "Primary" diesignating that the B record thus designated ia the one and only B record that is "Primary" among its siblings.

    To achieve this we need to assure that one and only one B record at a time is set as "Primary." This means that when the first B record is created, it must be marked as "Primary" and that if among multiple B records the users attempts to change a non-Primary record to "Primary," the previously designated "Primary" record must be changed to non-Primary so that two primary records do not exist at once.

    This will be my first plug-in so I'm not too sure footed.  I have read and re-read the SDK plug-in documentation, but it seems very short on information on how to obtain and use information from the Plug-in Data Context.

    To accomplish the task, I will need to extract some information from the Context on idnetifying the Parent Record (A above) and Child record (B above).  I think I probably need and EntityReference for the parent (A) so I can use it in a LINQ query (Where Clause) to walk the children and check which are currently set to Primary.  I also need to know which child (B) record was just updated or created so I know which one the user intended to be the NEW primary. 

    If there is more (better) documentation on the contents of the Plug-in Data Context (especially the Input Parameters) that can help me I would appreciate the reference.  Also if there are any code samples that are applicable to the above stated problem, I would love to look at those as well.

    Thanks in advance.



    Monday, June 11, 2012 4:25 PM


All replies