My organization would like to create what is essentially a custom audit log -- a custom entity where records are added when fields in Contact or Case are changed.
After some research, it appears I can do this two ways:
- Microsoft Power Automate (Flow), where when the entity record is modified, it triggers a flow;
- Via the Client API, with an attached event from a web resource;
Personally, I'd prefer to use JavaScript, it gives me a lot more control. But I'm new to Dynamics CRM, and wanted to run this by the community -- what would you do? What do you think is the best in terms of the future of Dynamics CRM?
My organization is on Dynamics CRM Online, v9 2020 wave 1.
On the change event of the attribute we want to log, I'd add the following, giving us a record of when that field was changed. Do you foresee performance problems? Compatibility issues? Thank you for any insight!
Xrm.WebApi.createRecord("custom_history", data).then(
function success(result) {
console.log("History created with ID: " + result.id);
},
function (error) {
console.log(error.message);
}
);