programmaticallyCloseTab function
If your task overrode or intercepted a user’s request to close your task, call the programmaticallyCloseTab function to request for z/OSMF core to close your task. Otherwise, your task will remain open.
Invoking the function
To call the programmaticallyCloseTab function, use the syntax shown in Figure 1.
win.global.zosmfExternalTools.programmaticallyCloseTab(pluginId, taskId);
- pluginId
- Unique identifier assigned to the plug-in that contains the task.
- taskId
- Unique identifier assigned to the task that you want to close.
When your task calls this function, z/OSMF core looks up the pluginId and taskId and attempts to close the corresponding z/OSMF tab. This close task request has the same behavior as the close request that is submitted when a user clicks the X to close the task tab.
For this service to work, z/OSMF core must be the parent of the tab that contains your task. For example, z/OSMF can use the programmaticallyCloseTab function to close your task when your task is launched from the z/OSMF navigation tree or when the task is launched with context by the Application Linking Manager.
z/OSMF cannot use this service to close your task if the task is open in another browser tab or window or if a user made your task a link and launched the task directly.
Example
function closeMyself(){
//Ensure that the Close Task confirmation window is not displayed.
win.global.zosmfExternalTools.isContentChanged = function (){
return false;
}
//Call the parent to refer to z/OSMF core. Then, call the function.
parent.programmaticallyCloseTab("com.company.product","Product Name");
}