How to list all selected interests for a contact
Some tooltip text!
• 1 minute to read
• 1 minute to read
You can list all selected interests for a specific contact using the ContactInterestHelper class.
You can achieve the same with the PersonInterestHelper class.
The helper classes provide the functionality that combines the MDO lists and what to select (they combine entity sub-collections with MDO lists).
Code
using SuperOffice;
using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Lists;
using (SoSession newSession = SoSession.Authenticate("sam", "sam"))
{
//Retrieve a Contact Based on the Contact ID
Contact newContact = Contact.GetFromIdxContactId(10);
//Get the list of heading items that are currently selected,
// (have link rows to the parent entity)
List<ISoListHeading> newLstHdItms = newContact.InterestHelper.SelectedHeadingItems;
//Get the list of root items that are currently selected,
// (have link rows to the parent entity)
List<ISoListItem> newLstItms = newContact.InterestHelper.SelectedRootItems;
}
Walk-through
In the code above, once we have created an instance of the Contact entity by using the Contact class, we use the contact’s InterestHelper to retrieve the selected interests. As shown above, we can retrieve the interest in 2 ways:
- using the
SelectHeadingItemsproperty - using the
SelectRootItemsproperty