• Betre Kenna
  • NEWBIE
  • 10 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I have a flow that has an input variable. I also have the following VF page which calls the flow. I would like to pass parameters to the lightning component inside the community using URL parameters like: 
http://<<communityURL>>/<<communityName>>?varFormName=signup I have tried so many ways but not be able to pass the variable. Here is the code:

<apex:page id="TrainingRegistration" showHeader="false" docType="html-5.0" 
            lightningStyleSheets="true" 
            
            sidebar="false" 
            standardStylesheets="false">

  
<html>
  <head>
  <meta content="width=device-width, initial-scale=1.0" name="viewport" />
     <apex:includeLightning />
     
  </head>
  <body class="slds-scope">
     <div id="flowContainer"/>
       
      <script>  
      // try to use a URL parameter to set the varFormName input variable for the flow
      const queryString = window.location.search; 
      //alert(queryString);
      const urlParams = new URLSearchParams(QueryString); 
      //alert(urlParams)
      const varFormName = urlParams.get('varFormName'); //URL param name
  
                     
      var statusChange = function (event) {
           if(event.getParam("status") === "FINISHED") {
              // Control what happens when the interview finishes

              var outputVariables = event.getParam("outputVariables");
              var key;
              for(key in outputVariables) {
                 if(outputVariables[key].name === "myOutput") {
                    // Do something with an output variable
                 }
              }
           }
        };
        $Lightning.use("c:publicForms", function() {
               // Create the flow component and set the onstatuschange attribute
               $Lightning.createComponent("lightning:flow", 
                   {"onstatuschange":statusChange},
                   "flowContainer",                
                   function (component) {
                     // Set the input variables
                       var inputVariables = [
                          {
                            name : 'varFormName',
                            type : 'String',
                            value : component.get(varFormName)
                            }
                    ];
                     // Start an interview in the flowContainer div, and 
                     // initialize the input variables.
                     //variable name inputVariables
                     //alert(inputVariables[0].value);
                     component.startFlow("Signup_Form", inputVariables);
                  }
               );
            }
        );   
        // for scaling on mobile
        window.onload = function(){
        var viewport = document.querySelector("meta[name=viewport]");
            viewport.setAttribute("content", "width=device-width, initial-scale=1.0");
        }
     </script>
  </body>
</html>

I really appreciate any help you can provide.
Hi All,

I am stuck with this challange 'Create a Visualforce page displaying new cases', could anyone help me?
I am getting this error message: "Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: unexpected token: WHERE"
I belive I did the class correctly. Here it is: 
public class NewCaseListController {
    
    public List<Case> getNewCases(){
        List<Case> results = Database.query(
                                'SELECT ID, CaseNumber, Status' +
                                'From Case ' +
                                'WHERE Status = \' New \'' );
        
        return results;
    }
}
Hi All,

I am stuck with this challange 'Create a Visualforce page displaying new cases', could anyone help me?
I am getting this error message: "Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: unexpected token: WHERE"
I belive I did the class correctly. Here it is: 
public class NewCaseListController {
    
    public List<Case> getNewCases(){
        List<Case> results = Database.query(
                                'SELECT ID, CaseNumber, Status' +
                                'From Case ' +
                                'WHERE Status = \' New \'' );
        
        return results;
    }
}