Skip to main content

Notifications

Microsoft Dynamics CRM forum
Unanswered

formContext.data.save() method clears email body

Posted on by 25

Hello everyone,

I have written a custom JS script to apply a value to a hidden field on the Email entity form and then save it with JS, however, after some tests I have discovered that the body of the email as well as Subject are being cleared. Have anyone encountered the same problem and are there any suggestions/ ideas what could be wrong? I have also tried to use the Xrm.Page method, but as I understood it is deprecated and that the formContext.data.save() method should be used instead.

Here's the JS script:

function setfield(executionContext) {

    var formContext = executionContext.getFormContext();
    console.log("setFieldValue");
    var createdBy = Xrm.Page.getAttribute('createdby').getValue();
    var bcc = Xrm.Page.getAttribute('FIELD').setValue(createdBy);
    formContext.data.save();

    }

By the way the CRM is on-premise 8.2 version (8.2.2.112)

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans