Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Getting error trying to trigger JavaScript "on change" event with workflow

Posted on by 777

I have a javascript that runs on the "appointment" entity. It gets the contact ID, makes an API call to a table related to Contact, pulls out some records from there, and then combines the information to create a "message" that we send to the contact prior to their appointment (like an appointment reminder with some extra details in it). We have been manually creating this message, but now are wanting to automate it being created in Dynamics, and then we can copy/paste it to send to the Contact. This would save a lot of time, as many of these messages go out everyday. 

I have some javascript that is triggered on a field change, and it all works fine when I have the form open. I was hoping I could simply set up a workflow to change the field that triggers the javascript, and thus run the script on multiple contact records at once from a grid view. However, when I select contacts from a view and run the workflow, the javascript doesn't fire. 

I also tried making it an editable grid view, adding the field that triggers the script and changing this field from the editable grid, but that doesn't fire the script either. 

Now I'm feeling like maybe I need to attach the script to a button on the ribbon. However, that will require rewriting much of the code, so I wanted to make sure there isn't an easier way before going down that road. 

Any thoughts on what can be done?

*This post is locked for comments

  • Ben T Profile Picture
    Ben T 777 on at
    RE: Getting error trying to trigger JavaScript "on change" event with workflow

    Would really appreciate any thoughts on this one. My gut says I need to rewrite it to work with a button on the ribbon. To be clear, what I need to do is select a bunch of records and press a button or run a workflow to have my javascript code (which is working on the form) run and update a field value.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans