web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Autopopulate email recipient field from custom entity

(0) ShareShare
ReportReport
Posted on by 20

Hi,

I need to configure Dynamics to auto-populate the "To" field when sending an email from a custom entity. What is the best way to do this?

pastedimage1648227420215v1.png

I have the same question (0)
  • Suggested answer
    Yoshika Suzuki Profile Picture
    on at

    If you're composing an email from another record, you may be able to do it with field mapping.
    If not, I think it can be done by customizing the form.

    docs.microsoft.com/.../form-onload

  • KaterinaD Profile Picture
    20 on at

    Тhe request is to be able to send an email directly from the form of the custom table to the primary contact of the corresponding Account.

    What is the most appropriate way to do this?

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You should write javascript code to achieve what you need.

    neilparkhurst.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • KaterinaD Profile Picture
    20 on at

    Тhank you for the answers. I was able to successfully do this with JavaScript code.

  • Hammed Profile Picture
    366 User Group Leader on at

    How did you achieve this?

    I have a similar requirement. Could you please share the script?

    I will really appreciate.

  • Hammed Profile Picture
    366 User Group Leader on at

    Please how did you solve this probs with JS as i have similar request.

  • Suggested answer
    KaterinaD Profile Picture
    20 on at

    I was able to populate the field by using this script:

    // *** Function to set a party list

    function setToPartyList(fieldName, id, name, entityType) {

     var party = Xrm.Page.getAttribute(fieldName);

     // Create new array

     var partlist = new Array();

     partlist[0] = new Object();

     partlist[0].id = id;

     partlist[0].name = name;

     partlist[0].entityType = entityType;

     // Set array value

     party.setValue(partlist);

    };

  • Daniel_5426 Profile Picture
    10 on at

    Where do I enter this code?

  • KaterinaD Profile Picture
    20 on at

    You should add this script in the Form Properties of the form that contains the lookup field to the onLoad event.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans