Forum Discussion
How do I bring the "self" variable back after the dialog returns? When i set a debugger statement in the callback function and check what variables I have, I can't find the variables from before the dialog was called. My action and method are acting on a relationship item, and it seems like the context after the dialog is the parent item of the relationship instead of the relationship item which is the context before the dialog is opened.
I had some success with aras.IomInnovator, I used:
function callback(res) {
if (res) {
var sel_id = res[0];
var rel_id = res[1];
var inn = aras.IomInnovator;
var rel_item = inn.getItemById("RelationshipItemtype",rel_id);
var sel_item = inn.getItemById("RelatedItemtype",sel_id);
rel_item.setProperty("related_item_property",sel_item);
rel_item.apply();
}
}
I can see that rel_item and sel_item are successfully defined in the debugging mode, but the property isn't being updated.
It actually seems to be working now! I just didn't realize since the relationship grid didn't update to show it until I did an empty search, I guess I just need to figure out how to make the method run an empty search as well.
- christopher_gillis7 years agoNew Member
Hi Rick,
You can take advantage of another function of the aras object to refresh the grid. You can call aras.uiReShowItem(item_id, item_id); in order to refresh the parent item. Since you said that the this variable seems to be referencing the parent item in the callback, you might be able to accomplish this refresh like so:
aras.uiReShowItem(this.getAttribute("id"), this.getAttribute("id"));
Note that this will depend on what the actual value of this is.
In regards to your question about referencing the self variable, I was able to reference this variable just by calling self inside of the callback. This was a test I ran in 11.0 SP15 using the ArasModules.Dialog.show function. This variable reference might be different if you are using another version of Aras Innovator or a different function for opening your dialog.
Chris
- RickP7 years agoIdeator I
I'm on v11 SP12 so maybe it's different, the window is being called like this:
var topWnd = top.aras.getMostTopWindowWithAras();
var wnd = topWnd ? topWnd : window;
wnd.ArasModules.Dialog.show('iframe', param).promise.then(callback);Thanks for the help anyways!