Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

formContext.data.save() method clears email body

$
0
0

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)


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images