I am new to SDL Tridion developing GUI Extension. I have created config file. It is bringing text in context menu. But on click it is not hitting JavaScript from .js file.

following is my config code

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge" xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
  <resources cache="false">
      <cfg:group name="Counter.Commands" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" merge="always">
          <cfg:file type="script">/Counter/Counter.js</cfg:file>
         <cfg:file type="reference">Counter.CommandSet</cfg:file>
      <ext:editorextension target="CME">
        <ext:editurls />
        <ext:commands />
            <ext:extension name="Counter" assignid="ext_Counter" insertbefore="cm_refresh">
              <ext:menudeclaration externaldefinition="">
                <cmenu:ContextMenuItem id="ext_Counter" name="Counter Count:" command="Counter"/>
                <ext:view name="DashboardView"/>
    <cfg:commandset id="Counter.CommandSet">
    <cfg:command name="Counter" implementation="Extensions.Counter"/>

and my JavaScript code as follow:


Extensions.Counter = function Extensions$Counter() {
    Type.enableInterface(this, "Extensions.Counter");
    this.addInterface("Tridion.Cme.Command", ["Counter"]);

Extensions.Counter.prototype.isAvailable = function Counter$isAvailable(selection) {
    return true;

Extensions.Counter.prototype.isEnabled = function Counter$isEnabled(selection) {
    if (selection.getItems().length > 1)
        return false;
        return true;

Extensions.Counter.prototype._execute = function Counter$_execute(selection) {
    selectedItem = selection.getItems()[0];
    prompt("Copy the Item ID using Ctrl/Cmd + C:", selection.getItems()[0]);

Thanks in advance.

i am getting error :Command 'Counter' is not registered on same question what it means

2 Answers 2


At quick glance, looks like you are adding the reference to your commandset from your resource group in the wrong place, you should add it like:

    <cfg:file type="script">/Counter/Counter.js</cfg:file>
    <cfg:file type="reference">Counter.CommandSet</cfg:file>

In your example you have it in the dependencies section, make sure to take it out of there.

Also make sure you are increasing the modification attribute in System.config after making your changes. If you are still seeing issues, try adding some logs (outside and inside your class) and checking the console window to see if they are getting hit (and to see if there are any errors anywhere) to see if there's an issue with your command or with the JavaScript not being included.

Hope that helps!


In your Js code try replacing your first five lines code with the below one :


Extensions.Counter = function Extensions.Counter() {

Type.enableInterface(this, "Extensions.Counter");
this.addInterface("Tridion.Cme.Command", ["Counter"]);

This may help.

  • 1
    Hi SDLBeginner and thanks for sharing an answer! The above would actually cause a syntax error on the line Extensions.Counter = function Extensions.Counter() {. You can't have the "." within function names.
    – Alex Klock
    Commented Aug 18, 2014 at 13:13
  • Hi @AlexKlock .. but i used the same for one of the functionality extension long back. I am not sure weather this will throw any syntax error. Thank you for bringing this in my notice. Commented Aug 18, 2014 at 13:24
  • 1
    Just to be clear SDLBeginner, you simply need to change the function name so that your second line of code becomes Extensions.Counter = function Extensions$Counter() {. It's only the name after the function keywords that can't contains dots, which is why they are often replaced with something like a $. Commented Aug 18, 2014 at 16:43
  • @FrankvanPuffelen i am getting Command "'Counter' is not registered" what it means
    – Pankaj786
    Commented Aug 20, 2014 at 7:08

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.