Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Differentiate between parent and child activities in social pane or subgrid

(0) ShareShare
ReportReport
Posted on by 3,079

We're looking at some options to show all activities from child records on a parent record - all child accounts of a parent account, for example.  If we use the social pane (or look at the associated view), all of the correct records show up.  However, there doesn't seem to be a way to tell which record is from which child account, other than opening each one.  Same if we look at the associated view, or use custom fetch to return all related records - I can't find any way to show which activities belong to which account.  Has anyone found a way to do this?

*This post is locked for comments

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Differentiate between parent and child activities in social pane or subgrid

    Another thing we're tackling, related to this - if you add an activity, it just fills in the parent record automatically, which isn't our desired behaviour either.  :-(  This is just full of fun...

    Anyway, I created custom ribbon flyout buttons for each activity we use (just email, phone, and appointment in this context).  I'm then populating them dynamically, with a query that gets the child records and adds them plus the parent record to the list as options.  Based this off of Scott Durow's blog post here:  www.develop1.net/.../Add-Dynamic-Menu-to-Ribbon-Button    Still tweaking a few things with these, but think it'll work.

  • Verified answer
    awalters Profile Picture
    awalters 3,079 on at
    RE: Differentiate between parent and child activities in social pane or subgrid

    Alright, finally got this to work!  Man, that was complicated.

    Note: this is all using an Activity subgrid, not the Social Pane:

    1.  Implemented Jonas Rapp's solution to use an Activity subgrid with a special view that triggers a query modification plugin, as seen at jonasrapp.net/.../all-activities.  Made sure this query modification plugin was registered on RetrieveMultiple of Activity, pre-operation.

    2.  Modified his solution to add an extra column with data that identifies what record this is (there are a variety of fields you can pick for this, depending on your implementation/needs).  Also changed it so there's an if/then for what stage the context is in, and made the query mod code only run on stage 20 (pre-op).  A great trick if you have to modify this code is to use Jonas's tool in XRMToolBox to build your fetchXML, and then generate the c# QueryExpression lines required.

    3.  Added a column in the view being used above, that is of the same type as the field we want to show.  Text to text, etc...  In this case, we were using a lookup, so it has to not only be a lookup field but one to the same entity.  Sadly, there were no fields on Activity of that type, and we cannot add fields to Activity.  So, had to use a field from a related entity (doesn't matter which one, since we're overwriting the display later.  See next steps)

    4.  In the same plugin, if the context is stage 40 (post-op), run code that I based of off Aileen Gusni's blog post (missdynamicscrm.blogspot.com/.../intercept-columnfield-value-in-crm-view-retrievemultipleplugin.html) to overwrite the data being displayed.  Note, this doesn't actually touch the real data - it just hijacks the display value.  The tricks I ran into here were that:

              a. the data I wanted isn't a column on the main result, it's a level down.  So instead of using 'entity.Attributes["fieldname"]' I had to use entity.Attributes["linkentityalias.fieldname"]' to retrieve my added data from the query.  And

              b. since the column I was using was on a related entity, again, it was one level down.  So I couldn't use entity.Attributes["fieldname"], but relatedEntity.fieldname wasn't working, etc...  Had to put in a breakpoint and look at the code to realise that it wanted entity.Attributes["GUID.fieldname"].  Couldn't figure out what the GUID was for for the longest time - wasn't the entity, wasn't the relationship, wasn't the view...eventually discovered it was the alias for the link-entity in the view definition.  So the way I was using linkentityalias.fieldname to reference my query, it was using the same syntax to reference the view columns.  But of course it just gives it a GUID instead of an easy to read alias.  I worry this might change in migration to live, so I'll keep an eye on it.

    5.  Register a second step on the same plugin, still for RetrieveMultiple of Activities, but this time on post-op, to run the above code.

    Voila!  I can now see all activities for a contact and all child contacts on the parent record, with something on each line to show which record it's actually attached to.

    I really hope something more built-in happens for this in future (I mean, it doesn't seem very helpful to have all of the activities mashed together without being able to also see where they come from, but I guess everyone's use cases are different).

    Hopefully this is helpful to someone else, anyway!  :-)

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Differentiate between parent and child activities in social pane or subgrid

    Okay - figured out the next step.  The issue was that I wasn't seeing the parameter to insert into because the records had nothing in it.  Now I can fill in text data and it's fine.

    So...I can add the attribute I need to the query in pre-operation, and I can modify a column in the view in post-operation.  However, I still can't figure out how to access the data I need (the column I added in the query, which is coming from the contact record) in order to load it into the view column.  I've tried just using the column name I set, and it's not returning anything.  :-(

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Differentiate between parent and child activities in social pane or subgrid

    UPDATE:  I'm playing with the plugin code for a custom fetch - I've figured out how to add a column for the link-entity, so theoretically I can have the data.  Now I just need to figure out how to show it...can I modify the layoutxml in c# for an existing view?

    Hmmm....thinking about this further...  The current implementation on this custom fetch is something I modified from a solution of Jonas Rapp's - it fires on retrievemultiple of activitypointer and modifies the query.  That's firing on pre-operation.  Looking at a blog post of Aileen Gusni's (http://missdynamicscrm.blogspot.com/2016/03/intercept-columnfield-value-in-crm-view-retrievemultipleplugin.html), it looks like maybe I can modify the returned data in a post-operation step.  However, when I look at the BusinessEntityCollection attributes, it actually doesn't have all of them that I have in my view (I put one in as a placeholder), so I'm not sure how to modify an attribute when it isn't there to begin with...

  • Arun Vinoth Profile Picture
    Arun Vinoth 11,615 on at
    RE: Differentiate between parent and child activities in social pane or subgrid

    Not at this moment. But we are also looking for such nice customization capabilities, but nothing supported.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans