• Kory Leavitt 5
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I am trying to update the Sample_QB_Error__c field with Hello
This code throws "an Invalid or unexpected token"  

Thanks
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} 
var record = new sforce.SObject("Opportunity"); 
record.Id = ‘{!Opportunity.Id}’; 
record.Sample_QB_Error__c ="Hello"; 
sforce.connection.update([record]); 
window.location.reload();

 

I've built a Flow that creates a new record for a Custom object. I'm setting a variable to the new id in the Flow, but I think my VF page is reading its value at creation, which is null. How do I set a page reference to the new id so I can redirect to the new Dispatch__c object? 

 

Controller:

public class DispatchFlowController {
	
	public Flow.Interview.New_Dispatch_Flow theFlow {get; set;}
		
	public PageReference getNewDispatchRecord(){
		if(theFlow == null)
			return null;
		else
			return new PageReference('/' + theFlow.NewDispatchId);
	}
	
}

 VF Page:

<apex:page Controller="DispatchFlowController" >
<flow:interview name="New_Dispatch_Flow" interview="{!theFlow}" 
	finishLocation="{!NewDispatchRecord}"/>
</apex:page>

 note, if I hard-code the new PageReference to an existing id it does redirect to that object instance, but obviously I don't know what id my new object will have until the end of the Flow.