1

I'm trying to implement an on Tab Focus and on Tab blur in the salesforce lightning, whenever there is On Focus to the Tab I need to create a new Record with a Start time in the Salesforce custom Object when it Blur is needed to update the same Record with End time.

Below is my code for your reference:

onTabFocused : function ( component, event, helper ) { 
    var focusedTabId = event.getParam('currentTabId');
    var workspaceAPI = component.find("workspace");
    workspaceAPI.isConsoleNavigation().then(function(isConsole) {
        if ( isConsole ) {
            workspaceAPI.getAllTabInfo().then(function(response) {
                for ( var i = 0 ; i < response.length; i++ ) {
                    if ( response[i].focused ) {
                        //Create records
                    } else {
                        // update focused records
                        // this part is not working
                    }
                }
            }).catch(function(error) {
                console.log(error);
            });
        }
    }).catch(function(error) {
        console.log(error);
    });
}

Can anyone please help, I not getting where I'm doing wrong?.

0

You must log in to answer this question.

Browse other questions tagged .