The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

How to do Mentions with Activity Feeds

How to do Mentions with Activity Feeds

  • Comments 0

During a group discussion, sometimes we want to call the attention of a specific person. Social networking discussions are no different. In Microsoft Dynamics CRM Activity Feeds, we call this a “mention”.

This blog covers the following topics:

  • Why Mention?
  • How we can Mention in the UI
  • Entities we can Mention
  • Mentions through the SDK

Why Mention?

Posting with a mention would make that post visible in the target record’s wall (if the record’s entity is wall-enabled). For example, Nancy and her team are discussing a sales pitch in the Activity Feeds wall and Nancy realizes that they need Jim’s opinion on something. She wants to call Jim’s attention by mentioning his name in a post, and Nancy’s post would show up in Jim’s personal wall. So the next time Jim views his wall, he will see Nancy’s post and would be able to easily reply and follow-up on the issue. Isn’t that convenient?

How we can Mention in the UI

To do a mention, just type in the ‘@’ symbol and select the record that you want to mention. The MRU (Most Recently Used) dropdown list shows the records that you have just recently accessed or opened with each row having the format of <Record Name> + <Record Entity> (e.g. Jim Wilson ● Contact).

The MRU is like a cache of the most-recently visited pages. The complete list can be viewed by clicking on the  icon in the upper portion the Navigation Pane. The MRU dropdown list in the wall displays selected out of the box entity records and all custom entity records.

There are two ways to access a record to mention: through the MRU dropdown list or through the lookup dialog.

A record will only be listed in the mentions dropdown if it has been previously accessed or opened. The dropdown by default shows only the last 7 most recently accessed records, and by typing in more text when doing a mention, would filter dropdown results specific to the typed string. This would allow you to view and select a record that is in the MRU but was not immediately displayed when typing ‘@’.

 

If the record that you wanted to mention is not in the dropdown list, select “Look up more records”. This will show the lookup dialog, which allows you to search for your target record. After selecting the record, just click on ‘OK’.

This should add the name of the record to the post box with curly brackets surrounding it. Removing the brackets or any part of the mention will automatically remove the whole mention.

 

After posting with a mention, the mentioned record will then be added to the MRU, so the next time you start a mention, the dropdown will contain the mentioned record. If that record was already present, it will be pushed to the first row of the list.

Entities we can Mention

All records of different entity types can be displayed in the MRU dropdown list including records of custom entities.

The lookup dialog allows you to search for records of the following entities: Account, Appointment, Case, Contact, Dialog Session, Lead, Opportunity, Phone Call, Queue, Recurring Appointment, Task, Team, User and all custom entities. For a custom entity to show in the list of entities in the lookup dialog, it needs to be added in Post Configurations by going to Settings -> Activity Feeds Configuration (make sure not to forget to publish the customizations). That is what I did to make the custom entity “Custom Entity” show in the lookup list of entities below:

Mentions through the SDK

To do a mention through the SDK, create a Post entity (see Post Entity Metadata) with the Text attribute value including a string with the format @[ObjectTypeCode, Guid, “DisplayName”] .

  • The first parameter is the type code of the entity (to know how to find the type code of a record, see How to Find the Entity Type Code).  
  • Every created record has an ID associated with it (which is the second parameter in the mention format).
  • The last parameter is the string that is displayed for the mention. So when we inject the string “@[2,13fb279a-52fe-e011-bedb-00155db58cf4,“Maria”] “ in the Text attribute value of the Post entity, we would be seeing a post containing a link with the text “Maria” that when clicked would open the contact record (Contact entity type code is 2) of the record with GUID = 13fb279a-52fe-e011-bedb-00155db58cf4.

Here is a sample of a generic code to create a post with a mention:

CrmSdk.Post post = new CrmSdk.Post();

post.Text = String.Format("This is a mention: @[{0},{1},\"{2}\"].",

Contact.EntityTypeCode, createdContact.Id, createdContact.FullName);

post.Source = new OptionSetValue((int)PostSource.ManualPost);   // manual post

post.RegardingObjectId = createdContact.ToEntityReference();

 

serviceContext.AddObject(post);

serviceContext.SaveChanges();

 

For more sample code, see Sample: Collaborate with Activity Feeds.

So to further take socializing in CRM to the next level, we can take advantage of mentions. By knowing how to mention through the UI, we can include other people in our conversations and easily point to existing records in CRM making our conversations more meaningful. Mentions through the SDK would make our applications richer by incorporating this functionality in workflows and plug-ins. To learn more about Activity Feeds, mentions, and posting, feel free to explore the Activity Feeds SDK Documentation.

Maria Christina Joaquin

Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post