5

I need to add a custom button for EE and run a script if the user clicks on the button. basically, I know how to create a button at the core database at

/sitecore/content/Applications/WebEdit/Ribbons/WebEdit

and I know that I need call command like item:executescript(id=$Target,script={93BAF91E-1111-4C90-8A1F-5AF71C9B7033},scriptDb=master) but I am not sure that should be set at layout option for this button at Sitecore Rock,

1
  • 2
    Did you ever find a solution for this? I've tried a few things, but it seems like the EE ribbon may need a backend task with Speak and JS. So far PowerShell scripts only seem to run via content editor ribbons, but Im hoping somebody else had better luck.
    – MikeD
    Mar 30, 2021 at 3:25

1 Answer 1

1

If you are doing a button on Experience editor ribbon, you should add the button in the core database.

e.g, We have added a button called Unlock Item - which unlocks the locked items of other users

Steps we followed to do this:

  1. Added a button in core DB under content --> Applications --> Content Editor --> Ribbons --> Chunks --> Workflow Edit
  2. Set the click event like 'contenteditorcustom:unlockitem'
  3. Created a Custom Command and implemented the logic in Execute method (in your case executing PowerShell script)
  4. Added a patch config for the command under commands with name 'contenteditorcustom:unlockitem' and set the type to the Custom command class.

This should enable the Experience editor button to function the way you want.

Hope this helps

2
  • 1
    These instructions should work for the content editor, but not in the Experience editor. So far I have not found a way to use PowerShell in EE ribbon buttons.
    – MikeD
    Mar 30, 2021 at 3:22
  • This will not work in experience editor.
    – Dheeraj p
    Nov 15 at 12:26

Your Answer

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

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