• Sean M 3
  • NEWBIE
  • 40 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
Good morning,

I have created a lightning component which runs a visual flow creating an Event record.

When the flow finishes I would like the page to be redirected to the created Event.

I have found a help topic with some example code but it would be great if someone could explain it ie. where would I add the created record id variable in my flow in this code so that it redirects?

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_flow_onfinish.htm
 
handleStatusChange : function (component, event) {
   if(event.getParam("status") === "FINISHED") {
      var outputVariables = event.getParam("outputVariables");
      var outputVar;
      for(var i = 0; i < outputVariables.length; i++) {
         outputVar = outputVariables[i];
         if(outputVar.name === "redirect") {
            var urlEvent = $A.get("e.force:navigateToSObject");
            urlEvent.setParams({
               "recordId": outputVar.value,
               "isredirect": "true"
            });
            urlEvent.fire();
         }
      }
   }
}

Thank you
Good afternoon,

I am using an Apex Class coupled with a visualforce page to redirect a user to a Case record created from a Flow, when the Flow ends.

Code below:
 
public class flowController{
  // Instanciate the Flow for use by the Controller - linked by VF interview attribute
  public Flow.Interview.QuickCase flowInstance {get;set;}

  // Set the page reference accessor methods
  public PageReference finishLocation {
    get {
      PageReference pageRef = new PageReference('/' + newRecordId);
      pageRef.setRedirect(true);
      return pageRef;
      
    }
 
  }

  // Set the accessor methods for the flow output variable
  public String newRecordId {
    get {
      String strTemp = '';

      if(flowInstance != null) {
        strTemp = string.valueOf(flowInstance.getVariableValue('CreatedCaseId'));
      }
      return strTemp;
    }

  set { newRecordId = value; }
  }
}

I am having trouble writing a Test Class for this. Can anyone give me a starting point?

Many thanks
Good day developers

I have a Apex Class in Sandbox which redirects a user to a record created from a visual workflow with the help of a visualforce page:

public with sharing class FlowRedirectController {

    public Object FlowRedirectController() { 
        String unique_id = ApexPages.currentPage().getParameters().get('id');
        
        if(unique_id == null){
            // Return Home if no ID 
            String url = '/home/home.jsp';
            return new PageReference(url);
         } 
         
         // Get Order ID and set Redirect 
         String orderId = [SELECT Name,
                                    Unique_Flow_Identifier__c, 
                                    Id  
                             FROM Order  
                             WHERE Unique_Flow_Identifier__c = :unique_id 
                             ORDER BY CreatedDate DESC   
                             LIMIT 1].Id;
                             
        // Did we find a Order? 
        if (orderId == null) {
            // Return Home if no ID 
            String url = '/home/home.jsp'; 
            return new PageReference(url); 
            }

        // Redirect to Order 
        String url = '/' + orderId;
        return new PageReference(url); 
        }
}


When deploying to production I am getting code coverage error. This is becasue I need to create an Apex Test Class however being new to Apex i'm unsure what I would need to test in this code... Is anyone able to help with this?

Thanks
Hi all,

I'm trying to add a previously created html email into a visualforce page but I keep getting the error below:

User-added image
Here is the start of my code (which i feel is causing the issue):

<messaging:htmlEmailBody >

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head>


I've tried adding </link> to line 158/159 but it doesn't make a difference.

Thanks