I need to add custom button of template /sitecore/templates/System/WebEdit/WebEdit Button to RTE in Experience Editor. And invoke my custom js function on click. How I can implement that?

I've added my function in js-file and included file in

<clientscripts><everypage> </everypage></clientscripts>

I've tried invoke my function from Command using


and I've tried to add


in Click field of sitecore item. But my function is always undefined.

How can I add javascript with my function to EE and call it for my custom button?

  • Does your "myFunction()" call is available from browser console?
    – Anton
    Commented Jan 15, 2019 at 13:28
  • @Anton no, I see undefined. Is there a specific way to add js script in EE mode?
    – Val Yar
    Commented Jan 15, 2019 at 13:42
  • a lot of ways to do it, check this article jammykam.wordpress.com/2017/07/24/… One of possible ways: @if (Sitecore.Context.PageMode.IsExperienceEditor) { <script src="pathtojs"></script> }
    – Anton
    Commented Jan 15, 2019 at 14:01
  • @Anton thanks, I'll try to add pipeline. My project is sitecore module, not a site.
    – Val Yar
    Commented Jan 15, 2019 at 15:13

1 Answer 1


I didn't find any other working way to do that, only this patch works for me

  <group groupName="ExperienceEditor" name="ExperienceEditor">
        <processor type="Sitecore.ExperienceEditor.Pipelines.PageEditingScripts.AddDeclaredScripts, Sitecore.ExperienceEditor">
          <path patch:after="*[last()]">/sitecore modules/Shell/MyApp/js/myCustom.js</path>

So, I added my custom js to list of paths and as I got, it will be bundled with others scripts for EE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.