Skip to main content
deleted 18 characters in body
Source Link

You have to use something like this. And they (getcreatorId etc.,) gives you the referrer, not the person who created that item.

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {  
    var selectedItem = selection.getItems()[0];
    var item = $models.getItem(selectedItem);

    var itemLoad = function (event) {
        var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);
    
        // variable that you want...
        var commentitemid = item.getId();
        var commenterid = item.getCreatorId();
        var commenter = $tcm.getItem(commenterid);
        var commentername = commenter.getDescription();
        var commentdate = item.getLastModifiedDate();
        var commentversion = item.getVersion();
    };


    if (item.isLoaded()) {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load(true);
    }
    else {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load();
    }
};

You have to use something like this. And they (getcreatorId etc.,) gives you the referrer, not the person who created that item.

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {  
    var selectedItem = selection.getItems()[0];
    var item = $models.getItem(selectedItem);

    var itemLoad = function (event) {
        var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);
    
        // variable that you want...
        var commentitemid = item.getId();
        var commenterid = item.getCreatorId();
        var commenter = $tcm.getItem(commenterid);
        var commentername = commenter.getDescription();
        var commentdate = item.getLastModifiedDate();
        var commentversion = item.getVersion();
    };


    if (item.isLoaded()) {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load(true);
    }
    else {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load();
    }
};

You have to use something like this. And they (getcreatorId etc.,) gives you the person who created that item.

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {  
    var selectedItem = selection.getItems()[0];
    var item = $models.getItem(selectedItem);

    var itemLoad = function (event) {
        var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);
    
        // variable that you want...
        var commentitemid = item.getId();
        var commenterid = item.getCreatorId();
        var commenter = $tcm.getItem(commenterid);
        var commentername = commenter.getDescription();
        var commentdate = item.getLastModifiedDate();
        var commentversion = item.getVersion();
    };


    if (item.isLoaded()) {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load(true);
    }
    else {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load();
    }
};
Formatted the code for readability.
Source Link
Peter Kjaer
  • 19.8k
  • 1
  • 23
  • 56

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {

var selectedItem = selection.getItems()[0];
var item = $models.getItem(selectedItem);


var itemLoad = function (event) {
                var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);

// variable that you want...

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

};


if (item.isLoaded()) {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load(true);
        }
        else {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load();
        }

};

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {  
    var selectedItem = selection.getItems()[0];
    var item = $models.getItem(selectedItem);

    var itemLoad = function (event) {
        var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);
    
        // variable that you want...
        var commentitemid = item.getId();
        var commenterid = item.getCreatorId();
        var commenter = $tcm.getItem(commenterid);
        var commentername = commenter.getDescription();
        var commentdate = item.getLastModifiedDate();
        var commentversion = item.getVersion();
    };


    if (item.isLoaded()) {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load(true);
    }
    else {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load();
    }
};

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {

var selectedItem = selection.getItems()[0];
var item = $models.getItem(selectedItem);


var itemLoad = function (event) {
                var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);

// variable that you want...

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

};


if (item.isLoaded()) {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load(true);
        }
        else {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load();
        }

};

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {  
    var selectedItem = selection.getItems()[0];
    var item = $models.getItem(selectedItem);

    var itemLoad = function (event) {
        var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);
    
        // variable that you want...
        var commentitemid = item.getId();
        var commenterid = item.getCreatorId();
        var commenter = $tcm.getItem(commenterid);
        var commentername = commenter.getDescription();
        var commentdate = item.getLastModifiedDate();
        var commentversion = item.getVersion();
    };


    if (item.isLoaded()) {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load(true);
    }
    else {
        $evt.addEventHandler(item, "load", itemLoad);
        item.load();
    }
};
Source Link

You have to use something like this. And they(getcreatorId etc.,) gives you the referrer, not the person who created that item.

PW.Commands.MyTask.prototype._execute = function (selection, pipeline) {

var selectedItem = selection.getItems()[0];
var item = $models.getItem(selectedItem);


var itemLoad = function (event) {
                var item = this;
        $evt.removeEventHandler(item, "load", itemLoad);

// variable that you want...

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

};


if (item.isLoaded()) {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load(true);
        }
        else {
                $evt.addEventHandler(item, "load", itemLoad);
                item.load();
        }

};