-
-
Save arun12209/44d6e89279a30825aa20992aa57eb88b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
navigateToActivityRecord : function(component,event,helper,ActivityRecord_ID) { | |
//Workspace API used to open the activity in sub tabs in console app | |
var workspaceAPI = component.find("workspace"); //get the workspace component | |
workspaceAPI.isConsoleNavigation().then(function(response) { //check if it is console app | |
workspaceAPI.getEnclosingTabId().then(function(tabId) { //get the parent tab id | |
return workspaceAPI.openSubtab({ //open sub tab | |
recordId: ActivityRecord_ID, //record id of activity | |
focus: true, //make the tab in focus | |
parentTabId : tabId //parent tab | |
}).then(function(response) { | |
workspaceAPI.getTabInfo({ | |
tabId: response | |
}).then(function(tabInfo) { | |
console.log("The url for this tab is: " + tabInfo.url); | |
}); | |
}) | |
.catch(function(error) { //catch errors | |
console.log('Error here >> ' + error); | |
//if(error == 'Error: API `openTab` is not currently supported in this application.'){ | |
var urlEvent = $A.get("e.force:navigateToSObject"); | |
urlEvent.setParams({ | |
"recordId": ActivityRecord_ID, | |
"isredirect": "true" | |
}); | |
urlEvent.fire(); | |
}); | |
}) | |
.catch(function(error) { | |
console.log(error); | |
}); | |
}) | |
.catch(function(error) { | |
console.log('catch : '+ JSON.stringify(error)); | |
}); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment