Setting properties using results from dialog

I'm having problems updating an item property using a method that opens a custom dialog. I opened a dialog following the ArasModules.dialog example from https://community.aras.com/b/english/posts/tech-tip-opening-a-custom-dialog-from-a-method, the dialog opens to a form where the user can select an item from a list which is returned in the "res" value of the callback function. Once there, I wanted to set the property of an item to this value, but it seems like i lost the original context item and innovator object after opening the dialog. When I debug in the browser the "this" item is of the [object window] type. The results contain two id strings, and I'm trying to use them to set an "item" property.

I tried defining a new innovator object and setting the property but I can't get it to actually apply the changes.

function callback(res) {
 if (res) {
    var id_1 = res[0];
    var id_2 = res[1];

    var inn = new Innovator();
    var item_2 = inn.newItem("MyItemType","edit");
    item_2.setID(id_2);
    item_2.setAttribute("select","MyProperty");
    item_2.setProperty("MyPropertyl",id_1);
    item_2.apply();
 }
}

How can I set the property from this context?

/Rick