Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:02:19+00:00 2026-06-12T17:02:19+00:00

I have written a GUI extension for SDL Tridion 2011 SP1. The GUI consists

  • 0

I have written a GUI extension for SDL Tridion 2011 SP1. The GUI consists of an extra ribbon button and event handler which is triggered when a component is saved.

My event handler is registered as follows:

PowerTools.Commands.ItemCommenting.prototype._execute = function (selection) {
    var item = $display.getItem();
    $evt.addEventHandler(item, "save", this.getDelegate(this._onItemSaved));
    $cme.getCommand("SaveClose")._execute(selection);
};

and the event handler looks like this:

PowerTools.Commands.ItemCommenting.prototype._onItemSaved = function (eventitem) {

    var comment = prompt("Please enter a comment", "");

    $messages.registerNotification("Saving user comments...");

    var commentitemid = eventitem.source.getId();
    var commenterid = eventitem.source.getCreatorId();
    var commenter = $tcm.getItem(commenterid);
    var commentername = commenter.getDescription();
    var commentdate = eventitem.source.getLastModifiedDate();
    var commentversion = eventitem.source.getVersion();

    //Call the service to update 
    PowerTools.Model.Services.AppDataServices.Append("ext:ItemCommenting", commentitemid, "<comment><user>" + commenterid + "</user><message>" + comment + "</message><datetime>" + commentdate + "</datetime><version>" + commentversion + "</version></comment>", null, null, null, false);

};

This is working fine, except that the variable commentername is always undefined. Is there a better approach for getting the name and description of a user?

Additionally, does anyone know if the value returned by eventitem.source.getCreatorId() is actually the Reviser or actually the person who created the item?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:02:20+00:00Added an answer on June 12, 2026 at 5:02 pm

    I normally follow this approach in Anguilla:

    1. use $models.getItem(item Id) to load objects, heard from someone (@puf?) that this is cached.
    2. check if the object.isLoaded() and if so, execute my event handler
    3. if the object is not loaded, then listen to the event

    It all comes down to something like this:

    p.keyword = $models.getItem(p.keywordUri);
    if (p.keyword.isLoaded()) {
        this._onReleaseKeywordLoaded();
    } else {
        $evt.addEventHandler(p.keyword, "load", this.getDelegate(this._onReleaseKeywordLoaded));
        p.keyword.load();
    }
    

    You would then call your model’s webservice from the event handler, since you’re sure the object will be loaded by then.

    In your current code you’re probably trying to read the description before the object is loaded, hence the undefined. I tend to place variables that I will need across multiple functions in the this.properties var (p in my example) then do something like this at the beginning of every function:

    var p = this.properties;
    var whatever = p.whatever;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GUI app written in C++/CLI which has a load of configurable
I have written a small GUI with qtdesigner and python which should display in
I have written a GUI application which after performing some analyses on a large
I have written a java program that is actually works as a gui to
I have a project that has a GUI (written in QT) and a command-line
I have complex GUI application written in Python and wxPython. I want it to
I have an application written in pure/basic Java without GUI. I have three classes
I have been attempting to enhance my GUI system written in Java to use
I'm a new bit in Qt... I have a Qt GUI application (written by
have written this little class, which generates a UUID every time an object of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.