Skip to main content

I have a pretty straightforward use case idea, just missing this last piece of info. Within the service cloud app, I want my users on a case creating a record as a related item (lets call that record a Case Note). They would do this through the related list section, clicking new record. I would have a SKUID page override for this Case Note object, and the user would essentially fill out fields pertaining to that note. This record would open as a sub-tab. At the end of the process, the user would click a “save & close” button with embedded actions that would save the record and close the sub-tab, and refresh the primary tab.

I can’t quite figure out how to “save & close” button in the last step. I don’t really have a javascript background, and I believe that would be the only way to achieve this. If anyone has thoughts, ideas, or suggestions, would love to hear them. Thank you #SKUIDNATION

Was able to achieve this if I put the code below on the apex page and run it via a button, but not sure why the same javascript wouldn’t work as in-line (Snippet) in SKUID?


function closeTab() {

        console.log(‘init’);

        if (sforce.console.isInConsole()) {

            sforce.console.getEnclosingPrimaryTabId(showTabId);

        }

    }

    var showTabId = function showTabId(result) 

    {

        var tabId = result.id;

        sforce.console.refreshPrimaryTabById(tabId , true, refreshSuccess);

    };

    

    var refreshSuccess = function refreshSuccess(result) {

        if (result.success === true) {

            console.log(‘2’);

            sforce.console.getEnclosingTabId(closeSubtab);

        } else {

            //any code

        }

    }; 

    var closeSubtab = function closeSubtab(result) {

        var tabId = result.id;

        console.log(‘1’);

        sforce.console.closeTab(tabId);

    }; 


Glad you were able to find a solution. 


yes, not ideal but it is functional. Hoping someone with the javascript knowledge can tell me what I am doing wrong here that wouldnt make the code work in SKUID.


Reply