Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to change Activities 'To' lookup field only lookup contacts/users and ignore the Accounts and Leads

(0) ShareShare
ReportReport
Posted on by 15

Hi, 

I am looking to restrict the 'To' field in emails, 'Required' field in Appointments and 'Call To' field in Phone calls. I want the lookup to only lookup Contacts or Users and not Accounts within the system.

Ideally the field should not allow any Accounts to be seen within the lookup when the users attempt to add a Contact to the call.

Thanks.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How to change Activities 'To' lookup field only lookup contacts/users and ignore the Accounts and Leads

    Hi Joshua,

    Based on your description, you want to restrict some entities in the 'To' field of email, you can write js code to achieve it.

    (1)addCustomFilter

    Adds filters to the results displayed in the lookup. Each filter will be combined with any previously added filters as an AND condition.

    addCustomFilter (Client API reference) in model-driven apps - Power Apps | Microsoft Docs 

    (2)setEntityTypes

    Sets the types of tables allowed in the lookup control.

    setEntityTypes (Client API reference) in model-driven apps - Power Apps | Microsoft Docs

    You can refer the following links, which provides detailed js code:

    (+) Restricting the Multi Entity lookup field Customer or Regarding Party list Entities from Email TO, CC, From – supported JavaScript on UCI Dynamics 365 - Microsoft Dynamics CRM Community

    (+) exclude other entities from "to/cc/bcc" partylist field other than contact - Microsoft Dynamics CRM Forum Community Forum

    pastedimage1658802192441v1.png

  • Suggested answer
    KK-365 Profile Picture
    1,010 on at
    RE: How to change Activities 'To' lookup field only lookup contacts/users and ignore the Accounts and Leads

    To, Required and Call to fields in Emails, Appointments and Phone Calls entity respectively are special Field called "Activity Party". Data type Party List.

    "An activity party represents another record (person or resource) that’s to be included in the activity. For example, it could be a contact, account, lead etc."

    It should allow to add/remove any entity type, as this will be stored with its respective PartyObjectTypeCode.

    You can use the below mentioned link:

     

    https://docs.microsoft.com/en-ie/dynamics365/customerengagement/on-premises/developer/activityparty-entity?view=op-9-1

    https://docs.microsoft.com/en-ie/dynamics365/customerengagement/on-premises/developer/entities/activityparty?view=op-9-1#BKMK_PartyObjectTypeCode

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.retrievemultiplerequest?view=dataverse-sdk-latest

    Please mark this answer verified once the issue is resolved.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans