Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Web Resources Javascript that triggers on form load for contextual emails

Posted on by 2,095

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

  • Verified answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Web Resources Javascript that triggers on form load for contextual emails

    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

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans