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

Web Resources Javascript that triggers on form load for contextual emails

(0) ShareShare
ReportReport
Posted on by 2,175

Hi all,

So with the roll out of the new contextual emails where composing an email from a case or opportunity will instead pop up the email composer box contextually on the case or opportunity record as opposed to the full email.

I've got some javascript that loads upon email form load. I was just wondering how this would work with the new contextual emails. Will I need to change the script in anyway or will it still work as per normal.

If there's any documentation I can read up on the new contextual emails and how javascript would work with it, that would be great!

Kind regards,

Mike

I have the same question (0)
  • Verified answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    If you want to trigger the onLoad event JS function on contextual emails, you should add the events on "Enhanced form", adding the code in "Main form" will not run the code.

    For example, I added the following code to Enhanced Email form onLoad event to set a default value to Subject.

    pastedimage1578905580832v1.png

    function testOnload(executionContext){
        var formContext = executionContext.getFormContext();
        formContext.getAttribute("subject").setValue("TestSubject");
    }

    When I opened the contextual email form from Account, the onLoad event worked well.

    pastedimage1578905745776v2.png

    Hope it helps.

    Best Regards,

    Leo

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 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

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

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans