Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Set Email "From" Field to General Support Email

Posted on by 45

I am trying to set the email "From" field to a specific email address/user OnLoad.  I have done something similar for the "Subject" field using javascript and added it as web resource to the form but I've been unsuccessful in doing so for the "From" field.  I do not know javascript specifically but I know enough to modify it for my needs if I find something similar that someone has written.  That is how I achieved the "Subject" line fix.  Does anyone know how I can set the "From" field on the email form to a specific user OnLoad? I don't believe I can get a flow to do this but if someone knows a way I am all ears!

Any help is greatly appreciated.

Thanks!

  • lawilliams713 Profile Picture
    lawilliams713 45 on at
    RE: Set Email "From" Field to General Support Email

    Ah! So simple!!!  Worked like a charm.  Thank you!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Email "From" Field to General Support Email

    Hi lawilliams713,

    You can use the following js code: 

    function setSender(executionContext) {
        var formContext = executionContext.getFormContext();
        var lookup = new Array();
        lookup[0] = new Object();
        lookup[0].id = "8c68629d-5555-ec11-8f8f-000d3a5b22fe";
        lookup[0].name = "Eric Gruber (Sample Data)";
        lookup[0].entityType = "systemuser";
        formContext.getAttribute("from").setValue(lookup);
    }

    Result:

    pastedimage1647488168870v1.png

    Note:

    pastedimage1647488497701v2.png

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans