web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Client-side JavaScript or Power Automate

(0) ShareShare
ReportReport
Posted on by 20

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);
}
);

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    the problem with javascript is that will run only on the form, if the record you want to log the changes is updated by server side (for example an integration) the javascript will not run.

    The alternative is to use a plugin, in addition to the Power Automate option you already described, as they both will run when the changes are made regardless if is client ui or something else.

    Personally I would write a plugin, but with Power Automate is probably easier for a non-dev (you create the flow, set the conditions and fill the custom entity record)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 52

#2
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 43 Super User 2026 Season 1

#3
Ayesha Wajahat Profile Picture

Ayesha Wajahat 14

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans