Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to add save button on form

Posted on by 385

I feel like this should be easy...

We use Dynamics 365, I have a form with a multiline text field.

I would like to have a save button next to it that the end user can press that saves the form.

Yes I know I can tell them to use the 'button' on the bottom right of the screen... but end users like  big visible buttons.  Anyway.

I created a web resource html button that calls a function.

Created the jscript resource with basic save code.

I have added the jscript as a library on form properties.

I have added the webresource button on the form.

saved/published...

But nothing happens when I press the button.

Using the inspector I can see it was saying somethign about running scripts had not been enabled??  Googled it and somehow made that go away, but still getting error.

Couple weird things, in my html dynamics keeps adding something about emails every time I save it.  Then when the button fails says that is not an option.

So, I know first response is going to be 'post your code'... lol.  But honestly I have rewritten things so many times and tried so many things not sure that helps.

I'm assuming some one has already done this and can point me tot he instructions.

OR...

Is there a different option?

Also, what I didn't mention is I have a Microsoft Flow tied to when a record is updated... so need the button to kick off the flow.

Thanks,

Terry

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to add save button on form

    Hi partner,

    You could try my ways in my last answer, I used web resource without any third-party tools.

    Regards,

    Leo

  • Mattw112b Profile Picture
    Mattw112b 385 on at
    RE: How to add save button on form

    I cannot get the pcf control to work... I've followed instructions and done it a million times but never does anything.

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to add save button on form

    Hi partner,

    I also tried the PCF control mentioned above and I found that there's some uncertainty about its trigger condition. I add the JS code to onchange event and only triggered successfully few times.

    pastedimage1580711031564v1.png

    pastedimage1580711057987v2.png

    It doesn't always succeed. Maybe I didn't have the right configuration somewhere.

    Then I tried another way, I added an HTML page to show the save button on the form and it worked well.

    1.Create an HTML with save method JS to show the save button which you want to put on the form.

    pastedimage1580711551609v3.png

    2.Add the HTML into the form as a web resource.

    pastedimage1580711580765v4.png

    3.Save and publish. Let's have a try.

    pastedimage1580711674566v5.png

    Done!

    You could also refer to this blog.

    https://mscrmtutorials.com/create-a-custom-html-button-in-dynamics-365/

    Hope it helps.

    Best Regards,

    Leo

  • Mattw112b Profile Picture
    Mattw112b 385 on at
    RE: How to add save button on form

    PS - I just changed my JS code to:

    alert( 'Hello, world!' );

    saved/published...

    Refreshed my form and this instantly fired onload??  But I don't have this set to fire on load?  I only have it tied to OnChange specifically on my button?

    Annotation-2020_2D00_02_2D00_02-145041.png

    Terry

  • Mattw112b Profile Picture
    Mattw112b 385 on at
    RE: How to add save button on form

    Hi,

    I have imported this solution and added the control as shown in the video and instructions.  I have the button showing on my form, I have set the onchange fields to run a js function of a library I load on the form...  but when I click the button nothing happens.  No errors, nothing.  I have tried redoing this several times.  In the developer debugger in the browser I also see nothing when I click on the button.

    Any one actually having this work right now?  Can't figure out why it wouldn't be firing.

    Thanks,

    Terry

  • Suggested answer
    SErf Profile Picture
    SErf 655 on at
    RE: How to add save button on form

    In the new update the Save button on the top left will be enabled by default.

    docs.microsoft.com/.../save-always-visible-command-bar-edit-forms

    I would suggest you wait for the new update instead of spending resources on this.

    I do understand that users like big Save buttons but you can educate that Dynamics Autosaves everything when navigating away from a record or that they can use Ctrl. + S to save.

    You also have to load the WebResource on the form and not only add the library.

    In the window where you add the WR to the form you can execute it in the OnLoad method.

    Still, I'd suggest you wait it out.

    Good day!

  • Suggested answer
    ba365guy Profile Picture
    ba365guy 2,946 on at
    RE: How to add save button on form

    Have a look at this link and the video in the link. This might help.

    pcf.gallery/.../

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans