Redirect to VF Page not firingHow can an apex:pageBlockSection be rerendered if it originally has a render...

Least cost swapping in C++

Why do my bicycle brakes get worse and feel more 'squishy" over time?

Simulation optimisation: Monte carlo simulation, regression, optimise within regression model?

How do figure out how powerful I am, when my abilities far exceed my knowledge?

Can the average speed of a moving body be 0?

Suspension compromise for urban use

Output the list of musical notes

Why does Japan use the same type of AC power outlet as the US?

Running code generated in realtime in JavaScript with eval()

How to gracefully leave a company you helped start?

What should we do with manuals from the 80s?

List, map function based on a condition

How to not forget things?

Is it really Security Misconfiguration to show a version number?

Who is the controller of a Pacifism enchanting my creature?

Are there really no countries that protect Freedom of Speech as the United States does?

Word for an event that will likely never happen again

Scam? Phone call from "Department of Social Security" asking me to call back

Can anybody tell me who this Pokemon is?

Is there a word for returning to unpreparedness?

Number in overlapping range

How to prevent criminal gangs from making/buying guns?

Graphs for which a calculus student can reasonably compute the arclength

Does an Irish VISA WARNING count as "refused entry at the border of any country other than the UK?"



Redirect to VF Page not firing


How can an apex:pageBlockSection be rerendered if it originally has a render value of false?Visualforce Button Redirect with URL reference to related AccountPassing value or linkinginput pick listCan a page reference method be called from within a void method?ApexPages.currentPage().getParameters().get() returning NULL when testing?isdtp=mn - Pop Task Page with no sidebar or headersVisual Force Page Grid CSSEditing Custom Lead Convert VF page






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















Good day,



I posted this over on the Salesforce Dev community forums but have gotten no responses. I'm hoping someone here might be able to assist.



We have a call center application integrated with Salesforce. This application requires that a "disposition" be chosen when completing a phone call. Once the disposition is selected, a task record is added in the task object for which the Call Result value is set to the value of the disposition.



Because users are able to disposition a call without ever actually opening the lead edit page, I would like to be able to redirect the user to a custom visual force page when a particular disposition is selected so that additional information can be gathered regarding that call.



Flow/Process Builder did not appear to be an option so I thought that I needed to go the route of creating an extension to the Lead controller which would then redirect the user to a custom VF page which would load a couple of values and allow the user to round out the info on the record.



I added some debug messages and found that things appear to be firing correctly when a task is created and the URL appears to be generating correctly. However, when a task is added, the redirect does not seem to fire and I'm left at the lead detail page, the VF page never loads.



Please note that my end goal here is to only have this fire when a specific value exists in the CallDisposition field of the task record and when the WhatID value of that task record is null. That will only ever take place when the scenario I am attempting to solve for occurs.



I created an after insert trigger on the Task object as shown here which calls an Apex class. Please note that i intend to do some additional validation of the WhatID and CallDisposition but have not added that yet.



    trigger RefundTaskSubmitted on Task (after insert)
{
List<Task> TaskValues = new List<Task>();
for (Task tsk: trigger.new)

{
String v_TaskID = Trigger.newMap.Get(tsk.ID).ID;
Task TaskData = [SELECT Id, WhoID, WhatID, CallDisposition FROM Task WHERE Id IN :Trigger.new];
if(TaskData.WhatID ==null)

{
String v_LeadID = TaskData.WhoID;
vf_LeadEdit.LoadRefundPage(v_LeadID);
}

else {

}
}

}



The vf_LeadEdit class is shown here which calls the visual force page :



    public class vf_LeadEdit
{
public final Lead ld;

public vf_LeadEdit(ApexPages.StandardController stdController)
{
this.ld = (Lead)stdController.getRecord();
}

public static PageReference LoadRefundPage(string LeadID)

{

PageReference myVFPage = new PageReference('/apex/vf_LeadRefund');
myVFPage.getParameters().put('ID', LeadID);
myVFPage.setRedirect(true);
return myVFPage;

}

}


The VisualForce page code is shown as follows:



    <apex:page standardController="Lead" extensions="vf_LeadEdit">
<apex:form >
<apex:tabPanel >
<apex:tab label="Enter Call/Refund Information" labelWidth="200">
<apex:PageBlock >
<apex:pageblocksection columns="1">
<b><font color="red">Instructions:</font></b> Instructions.
</apex:pageblocksection>
<apex:pageblocksection columns="1">
Additional Instructions
</apex:pageblocksection>
<apex:pageblocksection columns="1">
<b>First Name:</b> {!Lead.FirstName} <br/>
<b>Last Name:</b> {!Lead.LastName} <br/>
<b>Lead Source:</b> {!Lead.LeadSource} <br/>
<br/>

<apex:inputField value="{!Lead.Status}" label="Selected Status"/>
<apex:inputField value="{!Lead.Refund_Reason__c}" label="Reason Category"/> <br/>
<apex:inputField value="{!Lead.Borrower_Goals__c}" label="Reason Details" style="width: 280px; height: 80px"/> <br/>
<apex:inputField value="{!Lead.OwnerId}"/> <br/>

</apex:pageblocksection>
<div align="left" draggable="false">
<apex:commandButton action="{!save}" value="Save"/>
</div>
</apex:PageBlock>
</apex:tab>
</apex:tabPanel>
</apex:form>
</apex:page>


Update:



Initially I was encountering the following error when attempting to implement the suggestion:



System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Lead.Needs_RD__c



I found that this was because the field that I was updating to reflect that the lead needed to be updated was not included as field on the VF page being used for the override.



Here is what I ended up doing:



1) Added a field (API Name: Needs_RD__c") and added it to all page layouts for the Lead Object.



2) Added an override to the View action on the Lead object (see image)



enter image description here



3) Added a VF page named leadOverride with code as:



<apex:page standardController="Lead" action="{!if(Lead.Needs_RD__c='True', URLFOR($Page.vf_LeadRefund, null, [id=Lead.Id]), 
URLFOR($Action.Lead.View,Lead.Id,null,true))}">
<apex:outputText value="{!Lead.Needs_RD__c}" rendered="false"/>
</apex:page>



Adding the Needs_RD__c field as a non rendered field on the VF override page cleared up the SOQL errors I was getting.



4) I removed the controller extension from the vf_LeadRefund page posted above.



I am using process building to toggle the Needs_RD__c field values based on whether the lead needs to be updated or not.



All in all, much further along, thanks for the guidance!










share|improve this question









New contributor



Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    3















    Good day,



    I posted this over on the Salesforce Dev community forums but have gotten no responses. I'm hoping someone here might be able to assist.



    We have a call center application integrated with Salesforce. This application requires that a "disposition" be chosen when completing a phone call. Once the disposition is selected, a task record is added in the task object for which the Call Result value is set to the value of the disposition.



    Because users are able to disposition a call without ever actually opening the lead edit page, I would like to be able to redirect the user to a custom visual force page when a particular disposition is selected so that additional information can be gathered regarding that call.



    Flow/Process Builder did not appear to be an option so I thought that I needed to go the route of creating an extension to the Lead controller which would then redirect the user to a custom VF page which would load a couple of values and allow the user to round out the info on the record.



    I added some debug messages and found that things appear to be firing correctly when a task is created and the URL appears to be generating correctly. However, when a task is added, the redirect does not seem to fire and I'm left at the lead detail page, the VF page never loads.



    Please note that my end goal here is to only have this fire when a specific value exists in the CallDisposition field of the task record and when the WhatID value of that task record is null. That will only ever take place when the scenario I am attempting to solve for occurs.



    I created an after insert trigger on the Task object as shown here which calls an Apex class. Please note that i intend to do some additional validation of the WhatID and CallDisposition but have not added that yet.



        trigger RefundTaskSubmitted on Task (after insert)
    {
    List<Task> TaskValues = new List<Task>();
    for (Task tsk: trigger.new)

    {
    String v_TaskID = Trigger.newMap.Get(tsk.ID).ID;
    Task TaskData = [SELECT Id, WhoID, WhatID, CallDisposition FROM Task WHERE Id IN :Trigger.new];
    if(TaskData.WhatID ==null)

    {
    String v_LeadID = TaskData.WhoID;
    vf_LeadEdit.LoadRefundPage(v_LeadID);
    }

    else {

    }
    }

    }



    The vf_LeadEdit class is shown here which calls the visual force page :



        public class vf_LeadEdit
    {
    public final Lead ld;

    public vf_LeadEdit(ApexPages.StandardController stdController)
    {
    this.ld = (Lead)stdController.getRecord();
    }

    public static PageReference LoadRefundPage(string LeadID)

    {

    PageReference myVFPage = new PageReference('/apex/vf_LeadRefund');
    myVFPage.getParameters().put('ID', LeadID);
    myVFPage.setRedirect(true);
    return myVFPage;

    }

    }


    The VisualForce page code is shown as follows:



        <apex:page standardController="Lead" extensions="vf_LeadEdit">
    <apex:form >
    <apex:tabPanel >
    <apex:tab label="Enter Call/Refund Information" labelWidth="200">
    <apex:PageBlock >
    <apex:pageblocksection columns="1">
    <b><font color="red">Instructions:</font></b> Instructions.
    </apex:pageblocksection>
    <apex:pageblocksection columns="1">
    Additional Instructions
    </apex:pageblocksection>
    <apex:pageblocksection columns="1">
    <b>First Name:</b> {!Lead.FirstName} <br/>
    <b>Last Name:</b> {!Lead.LastName} <br/>
    <b>Lead Source:</b> {!Lead.LeadSource} <br/>
    <br/>

    <apex:inputField value="{!Lead.Status}" label="Selected Status"/>
    <apex:inputField value="{!Lead.Refund_Reason__c}" label="Reason Category"/> <br/>
    <apex:inputField value="{!Lead.Borrower_Goals__c}" label="Reason Details" style="width: 280px; height: 80px"/> <br/>
    <apex:inputField value="{!Lead.OwnerId}"/> <br/>

    </apex:pageblocksection>
    <div align="left" draggable="false">
    <apex:commandButton action="{!save}" value="Save"/>
    </div>
    </apex:PageBlock>
    </apex:tab>
    </apex:tabPanel>
    </apex:form>
    </apex:page>


    Update:



    Initially I was encountering the following error when attempting to implement the suggestion:



    System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Lead.Needs_RD__c



    I found that this was because the field that I was updating to reflect that the lead needed to be updated was not included as field on the VF page being used for the override.



    Here is what I ended up doing:



    1) Added a field (API Name: Needs_RD__c") and added it to all page layouts for the Lead Object.



    2) Added an override to the View action on the Lead object (see image)



    enter image description here



    3) Added a VF page named leadOverride with code as:



    <apex:page standardController="Lead" action="{!if(Lead.Needs_RD__c='True', URLFOR($Page.vf_LeadRefund, null, [id=Lead.Id]), 
    URLFOR($Action.Lead.View,Lead.Id,null,true))}">
    <apex:outputText value="{!Lead.Needs_RD__c}" rendered="false"/>
    </apex:page>



    Adding the Needs_RD__c field as a non rendered field on the VF override page cleared up the SOQL errors I was getting.



    4) I removed the controller extension from the vf_LeadRefund page posted above.



    I am using process building to toggle the Needs_RD__c field values based on whether the lead needs to be updated or not.



    All in all, much further along, thanks for the guidance!










    share|improve this question









    New contributor



    Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      3












      3








      3








      Good day,



      I posted this over on the Salesforce Dev community forums but have gotten no responses. I'm hoping someone here might be able to assist.



      We have a call center application integrated with Salesforce. This application requires that a "disposition" be chosen when completing a phone call. Once the disposition is selected, a task record is added in the task object for which the Call Result value is set to the value of the disposition.



      Because users are able to disposition a call without ever actually opening the lead edit page, I would like to be able to redirect the user to a custom visual force page when a particular disposition is selected so that additional information can be gathered regarding that call.



      Flow/Process Builder did not appear to be an option so I thought that I needed to go the route of creating an extension to the Lead controller which would then redirect the user to a custom VF page which would load a couple of values and allow the user to round out the info on the record.



      I added some debug messages and found that things appear to be firing correctly when a task is created and the URL appears to be generating correctly. However, when a task is added, the redirect does not seem to fire and I'm left at the lead detail page, the VF page never loads.



      Please note that my end goal here is to only have this fire when a specific value exists in the CallDisposition field of the task record and when the WhatID value of that task record is null. That will only ever take place when the scenario I am attempting to solve for occurs.



      I created an after insert trigger on the Task object as shown here which calls an Apex class. Please note that i intend to do some additional validation of the WhatID and CallDisposition but have not added that yet.



          trigger RefundTaskSubmitted on Task (after insert)
      {
      List<Task> TaskValues = new List<Task>();
      for (Task tsk: trigger.new)

      {
      String v_TaskID = Trigger.newMap.Get(tsk.ID).ID;
      Task TaskData = [SELECT Id, WhoID, WhatID, CallDisposition FROM Task WHERE Id IN :Trigger.new];
      if(TaskData.WhatID ==null)

      {
      String v_LeadID = TaskData.WhoID;
      vf_LeadEdit.LoadRefundPage(v_LeadID);
      }

      else {

      }
      }

      }



      The vf_LeadEdit class is shown here which calls the visual force page :



          public class vf_LeadEdit
      {
      public final Lead ld;

      public vf_LeadEdit(ApexPages.StandardController stdController)
      {
      this.ld = (Lead)stdController.getRecord();
      }

      public static PageReference LoadRefundPage(string LeadID)

      {

      PageReference myVFPage = new PageReference('/apex/vf_LeadRefund');
      myVFPage.getParameters().put('ID', LeadID);
      myVFPage.setRedirect(true);
      return myVFPage;

      }

      }


      The VisualForce page code is shown as follows:



          <apex:page standardController="Lead" extensions="vf_LeadEdit">
      <apex:form >
      <apex:tabPanel >
      <apex:tab label="Enter Call/Refund Information" labelWidth="200">
      <apex:PageBlock >
      <apex:pageblocksection columns="1">
      <b><font color="red">Instructions:</font></b> Instructions.
      </apex:pageblocksection>
      <apex:pageblocksection columns="1">
      Additional Instructions
      </apex:pageblocksection>
      <apex:pageblocksection columns="1">
      <b>First Name:</b> {!Lead.FirstName} <br/>
      <b>Last Name:</b> {!Lead.LastName} <br/>
      <b>Lead Source:</b> {!Lead.LeadSource} <br/>
      <br/>

      <apex:inputField value="{!Lead.Status}" label="Selected Status"/>
      <apex:inputField value="{!Lead.Refund_Reason__c}" label="Reason Category"/> <br/>
      <apex:inputField value="{!Lead.Borrower_Goals__c}" label="Reason Details" style="width: 280px; height: 80px"/> <br/>
      <apex:inputField value="{!Lead.OwnerId}"/> <br/>

      </apex:pageblocksection>
      <div align="left" draggable="false">
      <apex:commandButton action="{!save}" value="Save"/>
      </div>
      </apex:PageBlock>
      </apex:tab>
      </apex:tabPanel>
      </apex:form>
      </apex:page>


      Update:



      Initially I was encountering the following error when attempting to implement the suggestion:



      System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Lead.Needs_RD__c



      I found that this was because the field that I was updating to reflect that the lead needed to be updated was not included as field on the VF page being used for the override.



      Here is what I ended up doing:



      1) Added a field (API Name: Needs_RD__c") and added it to all page layouts for the Lead Object.



      2) Added an override to the View action on the Lead object (see image)



      enter image description here



      3) Added a VF page named leadOverride with code as:



      <apex:page standardController="Lead" action="{!if(Lead.Needs_RD__c='True', URLFOR($Page.vf_LeadRefund, null, [id=Lead.Id]), 
      URLFOR($Action.Lead.View,Lead.Id,null,true))}">
      <apex:outputText value="{!Lead.Needs_RD__c}" rendered="false"/>
      </apex:page>



      Adding the Needs_RD__c field as a non rendered field on the VF override page cleared up the SOQL errors I was getting.



      4) I removed the controller extension from the vf_LeadRefund page posted above.



      I am using process building to toggle the Needs_RD__c field values based on whether the lead needs to be updated or not.



      All in all, much further along, thanks for the guidance!










      share|improve this question









      New contributor



      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Good day,



      I posted this over on the Salesforce Dev community forums but have gotten no responses. I'm hoping someone here might be able to assist.



      We have a call center application integrated with Salesforce. This application requires that a "disposition" be chosen when completing a phone call. Once the disposition is selected, a task record is added in the task object for which the Call Result value is set to the value of the disposition.



      Because users are able to disposition a call without ever actually opening the lead edit page, I would like to be able to redirect the user to a custom visual force page when a particular disposition is selected so that additional information can be gathered regarding that call.



      Flow/Process Builder did not appear to be an option so I thought that I needed to go the route of creating an extension to the Lead controller which would then redirect the user to a custom VF page which would load a couple of values and allow the user to round out the info on the record.



      I added some debug messages and found that things appear to be firing correctly when a task is created and the URL appears to be generating correctly. However, when a task is added, the redirect does not seem to fire and I'm left at the lead detail page, the VF page never loads.



      Please note that my end goal here is to only have this fire when a specific value exists in the CallDisposition field of the task record and when the WhatID value of that task record is null. That will only ever take place when the scenario I am attempting to solve for occurs.



      I created an after insert trigger on the Task object as shown here which calls an Apex class. Please note that i intend to do some additional validation of the WhatID and CallDisposition but have not added that yet.



          trigger RefundTaskSubmitted on Task (after insert)
      {
      List<Task> TaskValues = new List<Task>();
      for (Task tsk: trigger.new)

      {
      String v_TaskID = Trigger.newMap.Get(tsk.ID).ID;
      Task TaskData = [SELECT Id, WhoID, WhatID, CallDisposition FROM Task WHERE Id IN :Trigger.new];
      if(TaskData.WhatID ==null)

      {
      String v_LeadID = TaskData.WhoID;
      vf_LeadEdit.LoadRefundPage(v_LeadID);
      }

      else {

      }
      }

      }



      The vf_LeadEdit class is shown here which calls the visual force page :



          public class vf_LeadEdit
      {
      public final Lead ld;

      public vf_LeadEdit(ApexPages.StandardController stdController)
      {
      this.ld = (Lead)stdController.getRecord();
      }

      public static PageReference LoadRefundPage(string LeadID)

      {

      PageReference myVFPage = new PageReference('/apex/vf_LeadRefund');
      myVFPage.getParameters().put('ID', LeadID);
      myVFPage.setRedirect(true);
      return myVFPage;

      }

      }


      The VisualForce page code is shown as follows:



          <apex:page standardController="Lead" extensions="vf_LeadEdit">
      <apex:form >
      <apex:tabPanel >
      <apex:tab label="Enter Call/Refund Information" labelWidth="200">
      <apex:PageBlock >
      <apex:pageblocksection columns="1">
      <b><font color="red">Instructions:</font></b> Instructions.
      </apex:pageblocksection>
      <apex:pageblocksection columns="1">
      Additional Instructions
      </apex:pageblocksection>
      <apex:pageblocksection columns="1">
      <b>First Name:</b> {!Lead.FirstName} <br/>
      <b>Last Name:</b> {!Lead.LastName} <br/>
      <b>Lead Source:</b> {!Lead.LeadSource} <br/>
      <br/>

      <apex:inputField value="{!Lead.Status}" label="Selected Status"/>
      <apex:inputField value="{!Lead.Refund_Reason__c}" label="Reason Category"/> <br/>
      <apex:inputField value="{!Lead.Borrower_Goals__c}" label="Reason Details" style="width: 280px; height: 80px"/> <br/>
      <apex:inputField value="{!Lead.OwnerId}"/> <br/>

      </apex:pageblocksection>
      <div align="left" draggable="false">
      <apex:commandButton action="{!save}" value="Save"/>
      </div>
      </apex:PageBlock>
      </apex:tab>
      </apex:tabPanel>
      </apex:form>
      </apex:page>


      Update:



      Initially I was encountering the following error when attempting to implement the suggestion:



      System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Lead.Needs_RD__c



      I found that this was because the field that I was updating to reflect that the lead needed to be updated was not included as field on the VF page being used for the override.



      Here is what I ended up doing:



      1) Added a field (API Name: Needs_RD__c") and added it to all page layouts for the Lead Object.



      2) Added an override to the View action on the Lead object (see image)



      enter image description here



      3) Added a VF page named leadOverride with code as:



      <apex:page standardController="Lead" action="{!if(Lead.Needs_RD__c='True', URLFOR($Page.vf_LeadRefund, null, [id=Lead.Id]), 
      URLFOR($Action.Lead.View,Lead.Id,null,true))}">
      <apex:outputText value="{!Lead.Needs_RD__c}" rendered="false"/>
      </apex:page>



      Adding the Needs_RD__c field as a non rendered field on the VF override page cleared up the SOQL errors I was getting.



      4) I removed the controller extension from the vf_LeadRefund page posted above.



      I am using process building to toggle the Needs_RD__c field values based on whether the lead needs to be updated or not.



      All in all, much further along, thanks for the guidance!







      visualforce controller redirect






      share|improve this question









      New contributor



      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited yesterday







      Brandon Stacy













      New contributor



      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked yesterday









      Brandon StacyBrandon Stacy

      184 bronze badges




      184 bronze badges




      New contributor



      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Brandon Stacy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          1 Answer
          1






          active

          oldest

          votes


















          3














          You can't redirect from a trigger. You would want to put a VF page or Lightning Component directly on the Lead record page in order to redirect to an edit page (or even your VF page). There's a few correct approaches to this, but your solution is not a valid one.



          If I were you, I'd have a trigger update a field on the Lead to indicate that it needs to be updated. Then, when the Lead page displays, redirect to your custom page or the edit page when the record loads. A simple override should suffice:



          <apex:page standardController="Lead" 
          action="{!if(Lead.Status='Needs Disposition',
          URLFOR($Page.updateLeadDisposition, Lead.Id),
          URLFOR($Action.Lead.View,Lead.Id,null,true))}" />


          Put this page in the Lead View override action (Setup > Object Manager > Leads > Buttons, Actions, and Links), and it should do as you'd like.






          share|improve this answer


























          • Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

            – Brandon Stacy
            yesterday











          • I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

            – Brandon Stacy
            yesterday
















          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Brandon Stacy is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f273557%2fredirect-to-vf-page-not-firing%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          You can't redirect from a trigger. You would want to put a VF page or Lightning Component directly on the Lead record page in order to redirect to an edit page (or even your VF page). There's a few correct approaches to this, but your solution is not a valid one.



          If I were you, I'd have a trigger update a field on the Lead to indicate that it needs to be updated. Then, when the Lead page displays, redirect to your custom page or the edit page when the record loads. A simple override should suffice:



          <apex:page standardController="Lead" 
          action="{!if(Lead.Status='Needs Disposition',
          URLFOR($Page.updateLeadDisposition, Lead.Id),
          URLFOR($Action.Lead.View,Lead.Id,null,true))}" />


          Put this page in the Lead View override action (Setup > Object Manager > Leads > Buttons, Actions, and Links), and it should do as you'd like.






          share|improve this answer


























          • Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

            – Brandon Stacy
            yesterday











          • I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

            – Brandon Stacy
            yesterday


















          3














          You can't redirect from a trigger. You would want to put a VF page or Lightning Component directly on the Lead record page in order to redirect to an edit page (or even your VF page). There's a few correct approaches to this, but your solution is not a valid one.



          If I were you, I'd have a trigger update a field on the Lead to indicate that it needs to be updated. Then, when the Lead page displays, redirect to your custom page or the edit page when the record loads. A simple override should suffice:



          <apex:page standardController="Lead" 
          action="{!if(Lead.Status='Needs Disposition',
          URLFOR($Page.updateLeadDisposition, Lead.Id),
          URLFOR($Action.Lead.View,Lead.Id,null,true))}" />


          Put this page in the Lead View override action (Setup > Object Manager > Leads > Buttons, Actions, and Links), and it should do as you'd like.






          share|improve this answer


























          • Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

            – Brandon Stacy
            yesterday











          • I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

            – Brandon Stacy
            yesterday
















          3












          3








          3







          You can't redirect from a trigger. You would want to put a VF page or Lightning Component directly on the Lead record page in order to redirect to an edit page (or even your VF page). There's a few correct approaches to this, but your solution is not a valid one.



          If I were you, I'd have a trigger update a field on the Lead to indicate that it needs to be updated. Then, when the Lead page displays, redirect to your custom page or the edit page when the record loads. A simple override should suffice:



          <apex:page standardController="Lead" 
          action="{!if(Lead.Status='Needs Disposition',
          URLFOR($Page.updateLeadDisposition, Lead.Id),
          URLFOR($Action.Lead.View,Lead.Id,null,true))}" />


          Put this page in the Lead View override action (Setup > Object Manager > Leads > Buttons, Actions, and Links), and it should do as you'd like.






          share|improve this answer













          You can't redirect from a trigger. You would want to put a VF page or Lightning Component directly on the Lead record page in order to redirect to an edit page (or even your VF page). There's a few correct approaches to this, but your solution is not a valid one.



          If I were you, I'd have a trigger update a field on the Lead to indicate that it needs to be updated. Then, when the Lead page displays, redirect to your custom page or the edit page when the record loads. A simple override should suffice:



          <apex:page standardController="Lead" 
          action="{!if(Lead.Status='Needs Disposition',
          URLFOR($Page.updateLeadDisposition, Lead.Id),
          URLFOR($Action.Lead.View,Lead.Id,null,true))}" />


          Put this page in the Lead View override action (Setup > Object Manager > Leads > Buttons, Actions, and Links), and it should do as you'd like.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          sfdcfoxsfdcfox

          282k14 gold badges231 silver badges482 bronze badges




          282k14 gold badges231 silver badges482 bronze badges
















          • Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

            – Brandon Stacy
            yesterday











          • I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

            – Brandon Stacy
            yesterday





















          • Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

            – Brandon Stacy
            yesterday











          • I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

            – Brandon Stacy
            yesterday



















          Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

          – Brandon Stacy
          yesterday





          Thank you very much! It appears I overthought this considerably. I will give this a shot and will report back.

          – Brandon Stacy
          yesterday













          I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

          – Brandon Stacy
          yesterday







          I was able to get this solution working (partially). I am updating my original post to include the code from the leadOverride VF page. I am still having a slight problem addressing my original problem but believe that will merit it's own topic. Thank you for the assistance!

          – Brandon Stacy
          yesterday












          Brandon Stacy is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Brandon Stacy is a new contributor. Be nice, and check out our Code of Conduct.













          Brandon Stacy is a new contributor. Be nice, and check out our Code of Conduct.












          Brandon Stacy is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Salesforce Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f273557%2fredirect-to-vf-page-not-firing%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m