locked
adding an existing attribute RRS feed

  • Question

  • Hi,

    I have created a new entity. I need to add an existing attribute from some other entity without creating that attribute in this new entity. Could anybody tell how to add that?

    Warm Regards,

    Dharmu
    Tuesday, March 3, 2009 4:54 PM

Answers

  • Dharmu - 

         Depending on what attribute you are talking about wanting to add and what circumstances it needs to be displayed this might not be possible.

         The Microsoft CRM customizations do not allow you to add an existing attribute from one entity to another newly created entity.   You can create a relationship between the newly created entity and an existing entity.  
         For example lets say we create a new entity called building.  This entity will represent a building that our accounts own.  Once we create the building entity be can create a N:1 relationship from building to account.  This allows each building to be connected to one account and allows each account to be connected to many buildings.  By creating this relationship you can now add the account lookup to the building form.  This will display the account primary attribute on the building form but using the Microsoft customization tools we cannot show any other existing account attribute on the building form. 
          Since there is now a relationships of N:1 between the building and the Account we can now show existing Account attributes in the building views but we cannot show them on the building form using the customization tools. 

          Their are custom ways you can show the existing attributes on the building forms.  Some ways contain recreating the attributes on the new custom entity and others include showing via custom code the attribute from the account entity. There are a few options depending on what you really need to have happen from just seeing the existing field on the form, to being able to update it on the form and if you need to see it when you are offline in the outlook client and update it their or not.

    1. Just show and on the form and keep in sync with the existing attribute.  You would have to recreate the existing attribute on the new entity, put it on the form and make it read only on the new entity form, then you could either just set up the mapping which would set it on create but this would not keep it in sync with the existing attribute if it is changed.  To keep it synchronized you would have to write a plug-in that would find all related entities when the attribute is changed and update the attribute to the new value.  Positives are that if a user is offline they can always see the value. 
    2. You can create an iFrame that is part of the new entity form which retrieves and shows the existing attribute from the related entity and displays it. You could also make it editable and have your iFrame call back in and update the related entity.  The positives about this is that you are not storing the value in two places that could end up getting out of sync but the negative is that it will only work when a user is online and has access to your iFrame.  Also the performance can be impacted because the iFrame is another page to render. 
    3.  Same idea as the iFrame but use JavaScript to get and the field. Same Pros and Cons just a slightly different approach. 

    Well I hope that helps give you the different options. 

    Later
       Hoss
      
    • Marked as answer by dharmu05 Tuesday, March 3, 2009 7:20 PM
    • Unmarked as answer by dharmu05 Friday, March 20, 2009 9:57 AM
    • Marked as answer by Jim Glass Jr Friday, March 20, 2009 7:15 PM
    Tuesday, March 3, 2009 5:56 PM

All replies

  • Just a quick answer before I leave for the day,  You need to create a relationship between the two entities.

    Navigate to

    Settings >>  Customization >>  EnityName >>  Then select 1:N or N:1 depending on the relationship type, once setup you will have your attribute

    Your Trusted Technology Partner
    Tuesday, March 3, 2009 5:50 PM
  • Dharmu - 

         Depending on what attribute you are talking about wanting to add and what circumstances it needs to be displayed this might not be possible.

         The Microsoft CRM customizations do not allow you to add an existing attribute from one entity to another newly created entity.   You can create a relationship between the newly created entity and an existing entity.  
         For example lets say we create a new entity called building.  This entity will represent a building that our accounts own.  Once we create the building entity be can create a N:1 relationship from building to account.  This allows each building to be connected to one account and allows each account to be connected to many buildings.  By creating this relationship you can now add the account lookup to the building form.  This will display the account primary attribute on the building form but using the Microsoft customization tools we cannot show any other existing account attribute on the building form. 
          Since there is now a relationships of N:1 between the building and the Account we can now show existing Account attributes in the building views but we cannot show them on the building form using the customization tools. 

          Their are custom ways you can show the existing attributes on the building forms.  Some ways contain recreating the attributes on the new custom entity and others include showing via custom code the attribute from the account entity. There are a few options depending on what you really need to have happen from just seeing the existing field on the form, to being able to update it on the form and if you need to see it when you are offline in the outlook client and update it their or not.

    1. Just show and on the form and keep in sync with the existing attribute.  You would have to recreate the existing attribute on the new entity, put it on the form and make it read only on the new entity form, then you could either just set up the mapping which would set it on create but this would not keep it in sync with the existing attribute if it is changed.  To keep it synchronized you would have to write a plug-in that would find all related entities when the attribute is changed and update the attribute to the new value.  Positives are that if a user is offline they can always see the value. 
    2. You can create an iFrame that is part of the new entity form which retrieves and shows the existing attribute from the related entity and displays it. You could also make it editable and have your iFrame call back in and update the related entity.  The positives about this is that you are not storing the value in two places that could end up getting out of sync but the negative is that it will only work when a user is online and has access to your iFrame.  Also the performance can be impacted because the iFrame is another page to render. 
    3.  Same idea as the iFrame but use JavaScript to get and the field. Same Pros and Cons just a slightly different approach. 

    Well I hope that helps give you the different options. 

    Later
       Hoss
      
    • Marked as answer by dharmu05 Tuesday, March 3, 2009 7:20 PM
    • Unmarked as answer by dharmu05 Friday, March 20, 2009 9:57 AM
    • Marked as answer by Jim Glass Jr Friday, March 20, 2009 7:15 PM
    Tuesday, March 3, 2009 5:56 PM
  • Thank you very much Hoss,

    It was the best explanation one can get. Hats off to you.

    Keep up the great work.
    Cheers,

    Dharmu
    Tuesday, March 3, 2009 7:22 PM
  • Hi,

    I created one new field(DW) on one entity(Account). I want this filed to be updated from some other entity(BL). BL entity already has this filed DW on its form. I created 1:N relationship on Account with BL. Then i mapped DW from BL to Account. But still DW field on Account is not taking value from BL entity.
    Please help.

    Regards,

    Dharmu.
    Friday, March 20, 2009 9:58 AM
  • Dharmu - 

         I would need a bit more info to understand exactly how you are using the mappings but I can give a quick rundown on how the mappings are used in CRM. 

    The mappings in Microsoft CRM related to relationships between entities are only used when you are creating a new related entity from the associated view. It does not update the fields if you change the 1 entity in the 1:N relationship after the N entity is created. 

    Example:  If you are on an Account form and click on Contacts down the left hand side.  If you click new related contact it will use the mappings to automatically transfer the address using the mappings.  But if you update the address on the account later it will not update the related contacts.  Also if you click new contact from the New record or the contact section and then select the parent account it will not bring down the address details using the mappings. 

    If you need them to stay in sync after you created a related entity you will have to build custom logic to accomplish that. 

    Hope that helps.
     - Hoss
    Friday, March 20, 2009 8:49 PM