+ Start a Discussion
Jugbeer BholaJugbeer Bhola 

Lightning Console Redirect

Currently I have a Visualforce page that is used to accept parameters from outside Salesforce. The visualforce page calls javascript and opens a tab in a lightnig console.  I am successful opening the lightning console tab when the values are all correct.  I am trying to use ApexPages.addmessage to display a message when the ID is not found.  The issue is that I continue to get 'Error: resolvePage() - Error determining State from pageReference'  An ugly error hits the page that has to be x'ed out of.  Then it says page not found.  Is there a method I could use to redirect to the 'Home Page of the Console?'
Best Answer chosen by Jugbeer Bhola
Raj VakatiRaj Vakati
Can share the code? 

All Answers

Raj VakatiRaj Vakati
Can share the code? 
This was selected as the best answer
Jugbeer BholaJugbeer Bhola
Thanks for attempting to help me Raj.  In the meantime I have found a solution. 
<apex:page cache="false" showHeader="true" sidebar="true" standardStylesheets="false" standardController="CustomerObject__c"  extensions="CustomObjectPage_CX" action="{!createObject}">
    <apex:includeScript value="/support/console/42.0/integration.js"/>   
    <script type="text/javascript">     
    function closeConsole() {
            function( p ){ 
    function warnUser(){      
        alert('The Customer You Have Requested Does not Exist in Salesforce.');      
public class CustomObjectPage_CX {    
    public String vCustomerId;
    public Static List<Wrapper> WrapperList;
    public CustomObjectPage_CX(ApexPages.StandardController controller)
        vCustomerId = ApexPages.currentPage().getParameters().get('customerId');       
    // method to create notification actions
    public PageReference createObject()
        //Retrieve it to collect the account number      
        WrapperList = dc.getData();
        if (!WrapperList.isEmpty()){
            AccountId = WrapperList[0].CDCustomerId;
            if (AccountId == null) AccountId = '';
            AccountId = '';
        return (String.isBlank( AccountId )) ? null : new PageReference( '/' + AccountId );        

Chris SalgadoChris Salgado
OP - did you ever figure it out? 
I am trying to display a custom error in Lightning when an Apex Trigger fails.
Right now we get the standard Stack Trace from all the Exceptions that are fired but I want a User Friendly message, any help is appreciated..
Chris SalgadoChris Salgado
Update: I figured it out my issue, using the sObject.addError() method to add my custom error.

Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm