locked
Is there an option that indicates an entity is eligible to be a RegardingObjectId on an activity? RRS feed

  • Question

  • I want a list of all entities that I can refer to with an entityreference in the Regarding field on an activity, as they appear in the first dropdown on the popup screen you get. I need these to display them in a field in a custom application outside of CRM that is used to accurately calculate the start and end times of a serviceappointment.

    When i check my Regarding field in CRM 2011 and view the list of available entities, I have a list of about 50-60 entities. However, when I do a RetrieveAllEntitiesRequest, it returns over 300 entities, and even if I filter out the entities with entitymetadata that don't have a UserLocalizableLabel in their DisplayName and a NameAttribute, I still have 192 entities. Less than 1/3 of those are available for the Regarding Field in an activity, and I only want to show those (using C#).

    Is there a way to just show the entities that appear in the Regarding field?

    Friday, May 23, 2014 1:09 PM

Answers

  • Aileen, I found that UpdateEntityRequest field, but I found a far better method that requires only 2 retrievals.

    I retrieved the EntityMetaData for the ServiceAppointment Entity, including the attributes. I then filtered the attributemetadata on the regardingobjectid, which has a property named "Targets" that contains an array with the names of all entities that may be looked up from this field. For now, I only need the entity names. I can then do a RetrieveAllEntitiesRequest and filter according to this targets list using Linq.


    Tuesday, May 27, 2014 1:26 PM

All replies

  • In the UI, on the entity configuration, you can find that under "Communications & Collaboration". The check box is labeled "Activities". I'm sorry, I do not know the name of it in the database.
    Friday, May 23, 2014 6:37 PM
  • James, I know that the UI shows it as that checkbox, but I want to know what property of the EntityMetaData that checkbox corresponds to.
    Monday, May 26, 2014 6:47 AM
  • Hi Nate, 


    I found in the SDK article and MSDN :

    For the Metadata to know, can use the .hasactivities

    http://msdn.microsoft.com/en-us/library/gg328452.aspx#BKMK_OptInOptions

    and this for specific.

    http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.messages.updateentityrequest.hasactivities.aspx

    HasActivities

    But, I still can find in the RetrieveEntityRequest.

    Otherwise, I think you can use the method :

    1. Go to Activity, and then check your Many to Many Relationship or EntityReference for regarding field or can be called as activitypointer, is that can refer to the entity, if yes, then means that this Entity has activities which is related to the Entity.

    2. Go to each Entity Request and access the entity metadata, go to each 1:N Relationship, and then check whether have or not relationship to Activity entity

    Hopefully it helps!

    Monday, May 26, 2014 4:36 PM
  • Aileen, I found that UpdateEntityRequest field, but I found a far better method that requires only 2 retrievals.

    I retrieved the EntityMetaData for the ServiceAppointment Entity, including the attributes. I then filtered the attributemetadata on the regardingobjectid, which has a property named "Targets" that contains an array with the names of all entities that may be looked up from this field. For now, I only need the entity names. I can then do a RetrieveAllEntitiesRequest and filter according to this targets list using Linq.


    Tuesday, May 27, 2014 1:26 PM