5

I would like to get the workflow info for a Component using the Tridion JavaScript Framework (Anguilla). When I create a new Component and it enters workflow, and then I use the following code it works. But, when I refresh the GUI it does not work any longer. How can I 're-load' this item and make sure getWorkflowInfo always gives me the good stuff?

var item = $models.getItem(selection.getItem(0));
var wfInfo = item.getWorkflowInfo();

if(typeof(wfInfo) != "undefined") {
    if(wfInfo.activityPerformedBy() == Tridion.UI.UserSettings.getJsonUserSettings(true).User["@ID"]) {

    }
}

1 Answer 1

6

you need to "load" an item before you can get workflow info, try this.

var item = $models.getItem(selection.getItem(0));

function itemLoaded() {
    $evt.removeEventHandler(item, "load", itemLoaded);

    var wfInfo = item.getWorkflowInfo();
    ...
}

$evt.addEventHandler(item, "load", itemLoaded);

item.load();

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.