I got a requirement to execute some validations, Save an Send an Email with Single button click.

To achieve this, we need validate first, Save the record and get the Email Id to send the Email. Xrm.Page.data.save() java script function executes Asynchronously so immediately we don’t get Email Id. Below is the process to get Record Id.

Xrm.Page.data.save().then(function () {

var id = Xrm.Page.data.entity.getId();

//Send Email



}, function () {

//handle error here