locked
CRM4.0 Retrieving values of the Selected entity in a Loopup field RRS feed

  • Question

  • Hello,

    I wanted to confirm that i'm headed downt he right path. I'm currently dealing with an entity Case and on the case forum theres a lookup field for a custom entity. When using this lookupfield and selecting a value apon returning to the case forum I need to populate two attributes with two values from the custom forum.

    In saying this I've done some research on it and unless I'm missing something; I believe I'm going to have to create a plugin to capture the post event of the Lookup field. I know by using the crmForm.all.<LookupAttribute>.DataValue[0].id; I can get the GUID; which I can then use a Fetch statement to retrieve the values of the entity I selected. Then having the value's I can populate the attributes I need to on the Case entity.

    Is this approach logical or am I missing some easier method of doing this? Is there any example code of this functionality existing?

    The best i've found so far is http://mscrm4ever.blogspot.com/2008/09/ajax-using-fetch-message.html which gives me a decent idea as to what I have to do; but not too much insight into the creating of a plugin to overwrite the post event on the loopup field.


    General information about the CRM environment I'm currently working on is CRM 4.0, multitenant environment.


    Tuesday, January 13, 2009 7:04 PM

All replies

  • You can also map the two fields from the custom entity to the Case form and train users to open the custom entity first and add a case to it.  The two fields should then auto-populate with the data.  I don't know if having the users create cases in this way is an option but if it is, it should work.  

     

    Another option might be to have a workflow run that pulls the value from the custom entity and updates the case.  As long as the custom entity field values are available to you in the workflow, this should work as well.

     

    I am sure you can also continue down the path you are on so please disregard this post if it does not meet your need.

    Tuesday, January 13, 2009 7:44 PM
  • Thank you for your quick response Donna and the options are great solutions. Unfortunately these options aren't applicable with our current system.  I think the path of the plugin seems to be the most reasonable method.

    Is there an existing tutorial or walk through on
    creating plugin's to capture the post event of a Lookup field.
    Tuesday, January 13, 2009 7:56 PM
  • Ok, you're welcome.  Have you looked at the SDK?  If not, I would begin there are there are examples.  Here is the link. 

    http://msdn.microsoft.com/en-us/library/cc160840.aspx

     

    There are also some good books like Programming Microsoft Dynamics® CRM 4.0.  Here is a link for that.

      http://www.microsoft.com/learning/en/us/books/12790.aspx

     

    Additionally there are several talented MVP's in the forum that do this type of work daily and one of them can most likely provide the type of information you need to move forward with your plug-in development.

    Tuesday, January 13, 2009 8:21 PM