7

I'm in the Service Cloud Console.

I have a flow embedded in a VF page. The VF page is a component on the account detail layout. The flow creates a case. When the flow is finished, I want the case detail page to open as a subtab.

Here is my VF page:

<apex:page standardController="Account" showheader="false" sidebar="false">
<flow:interview name="Support_Flow" finishlocation="/apex/SupportTicketFlow?id={!Account.ID}">
<apex:param name="varAccountID" value="{!Account.ID}"/>
         <apex:param name="varAccountName" value="{!Account.Name}"/>   
    </flow:interview>
</apex:page>
0

I haven't worked with flows yet. Though looking through the Visualforce documentation, I see there's no way to run javascript. Currently you need to know via javascript to see if you should a subtab (if user is in cloud console) or redirect/etc if user is on standard page view (non console)

What I'm trying to do here is see if the flow will rerender the bottom javascript portion to run and execute the top javascript which will do your redirect / close page / open new tab. Without testing, I would try something like such: (please keep in mind this is pseudo code as I have not tested / validated it.)

<apex:page standardController="Account" showheader="false" sidebar="false">
    <apex:includeScript value="/support/console/25.0/integration.js"/>
    <script type="text/javascript">
        function isInConsole() {
            return sforce.console.isInConsole();
        }


        function goToCase(caseId){ 
            var urlstring = '/' + caseId;                      
            if(isInConsole())
                srcUp(urlstring);
            else
                window.location.href = urlstring; /*redirect back to where you want to go*/
        }
    </script>

    <flow:interview name="Support_Flow" finishlocation="/apex/SupportTicketFlow?id={!Account.ID}" rerender="checkJavascript">
        <apex:param name="varAccountID" value="{!Account.ID}"/>
        <apex:param name="varAccountName" value="{!Account.Name}"/>   
    </flow:interview>

    <apex:outputPanel id="checkJavascript">
        <script type="text/javascript">
            if({!Account.customFieldLettingMeKnowFlowIsCompleted__c} == true)
                goToCase('{!Case.Id}');
        </script>   
    </apex:outputPanel>

</apex:page>
  • I think the javascript should be placed in the SupportTicketFlow page, as that is where the finishlocation is set. If that url is set to target="_blank"&caseId={!obtainedCaseId} this should work. I might test this myself – westerforce Mar 30 '15 at 5:22
0

I recently came across a similar requirement, and got around it by using another VF page. Since, JavaScript is not supported from within the flows, so that is out of the window.

In the finish screen of your flow put in the HTML, something like

<DIV ALIGN="LEFT">
   <A HREF="/apex/gotoCaseVfp?caseid={!caseid}" TARGET="_self">Click here</A> to go to case</FONT>
</DIV>

Where gotoCaseVfp in the above code is an assumed VF page.

Now, in the VF page you could either console's method openSubtab() or use the below Javascript to open the case in subtab

<apex:page showHeader="false" sidebar="false" standardController="Case">

<script type="text/javascript">
    var caseid;
    window.onload = function openCaseSubtab() {
       caseid = getParameterByName('caseid', window.location);
       srcUp('/caseid');
    }
    // get the parameter value
    function getParameterByName(name, url) {
        if (!url) url = window.location.href;
        name = name.replace(/[\[\]]/g, "\\$&");
        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
            results = regex.exec(url);
        if (!results) return null;
        if (!results[2]) return '';
        //alert ( decodeURIComponent(results[2].replace(/\+/g, " ")) );
        return decodeURIComponent(results[2].replace(/\+/g, " "));
     }    

 </script>

</apex:page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.