You need to sign in to do that
Don't have an account?

Can you pass parameters to a Flow using URLFOR ?
Hello,
I'm hoping it's possible to pass parameters to a flow using URLFOR and a custom button. I've created a VF page to list instructors available on a specific lesson day by passing the parameters of the lesson record ID , and the Lesson date within the url of the VF page button. Then created custom buttons to fire a Flow to "assign" or update the instructor on the lesson record. My first attempt using <param name= 'name'> to pass the varInstructorId and the varLessonId was not working, so i'm trying to pass the parameters within the URLFOR command.
VF Page:
Custom Button:
There are a few other issues i'm having with this page, but the most critical is inserting the Instructor__c onto the Lesson Record. I'm trying to stay away from apex, since this will need to be maintained by a non-profit without developer resources.
I'm hoping it's possible to pass parameters to a flow using URLFOR and a custom button. I've created a VF page to list instructors available on a specific lesson day by passing the parameters of the lesson record ID , and the Lesson date within the url of the VF page button. Then created custom buttons to fire a Flow to "assign" or update the instructor on the lesson record. My first attempt using <param name= 'name'> to pass the varInstructorId and the varLessonId was not working, so i'm trying to pass the parameters within the URLFOR command.
VF Page:
<apex:page standardcontroller="Schedule_Availability__c" recordSetVar="schedules" showHeader="FALSE" sidebar="False"> <apex:messages /> <!-- CSS --> <style> .lead { color: green; font-weight: bold; } .assist { color:red; font-weight: bold; } </style> <apex:form id="theForm"> <apex:pageblock mode="maindetail" title="{!$ObjectType.Schedule_Availability__c.label} for {!DATEVALUE($CurrentPage.parameters.Lesson__c.Lesson_Date__c)} "> <apex:outputpanel id="Available"> <apex:pageblocktable value="{!schedules}" var="s" columns="13" rendered="{!Schedule_Availability__c.Date__c= DATEVALUE($CurrentPage.parameters.Lesson__c.Lesson_Date__c)}" > <apex:Column styleClass="header" headervalue="Instructor" value="{!s.Instructor_Volunteer__c}"/> <apex:Column value="{!s.Discipline__c}"/> <apex:Column styleClass="lead" Headervalue="Lead Skills" value="{!s.Lead_Instructor_Skills__c }" style="color:green"/> <apex:Column styleClass="assist" Headervalue="Asst Skills" value="{!s.Assistant_Instructor_Skills__c}" style="color:red"/> <apex:Column value="{!s.Date__c}"/> <apex:Column value="{!s.Job_Roles__c}"/> <apex:Column headervalue="AM" value="{!s.Booked_AM__c}"/> <apex:Column headervalue="PM" value="{!s.Booked_PM__c}"/> <apex:column headervalue="Eve" value="{!s.Booked_Evening__c}"/> <apex:column headervalue="Lead Instr."> <apex:commandButton action="{!URLFOR($Action.Lesson__c.Assign_Lead_Instructor,Id,[varInstructorId='s.Instructor_Volunteer__c', varLessonId='$CurrentPage.parameters.id'])}" id="assign" value="Assign Lead"/> <!--<apex:param name="varInstructorId" value="{!s.Instructor_Volunteer__c}"/> <apex:param name="varLessonId" value="{!Id}"/>--> </apex:column> <apex:column headervalue="Asst 1"> <apex:commandButton action="{!URLFOR($Action.Lesson__c.Assign_Asst_1, Id)}" id="asst1" value="Assign Asst 1"/> <apex:param name="varInstructorId" value="{!s.Instructor_Volunteer__c}" /> <apex:param name="varLessonId" value="{!Id}"/> </apex:column> <apex:column headervalue="Asst 2"> <apex:commandButton action="{!URLFOR($Action.Lesson__c.Assign_Asst_1, Id)}" id="asst2" value="Assign Asst 2"/> <apex:param name="varInstructorId" value="{!s.Instructor_Volunteer__c}" /> <apex:param name="varLessonId" value="{!Id}"/> </apex:column> <apex:column headervalue="Asst 3"> <apex:commandButton action="{!URLFOR($Action.Lesson__c.Assign_Asst_1, Id)}" id="asst3" value="Assign Asst 3"/> <apex:param name="varInstructorId" value="{!s.Instructor_Volunteer__c}" /> <apex:param name="varLessonId" value="{!Id}"/> </apex:column> </apex:pageblockTable> <apex:panelGrid columns="3"> <apex:commandButton action="{!previous}" value="Previous"/> <apex:commandButton action="{!next}" value="Next" /> <apex:commandButton action="{!cancel}" value="Close Window" /> </apex:panelGrid> </apex:outputpanel> </apex:pageblock> </apex:form> </apex:page>
Custom Button:
/apex/AvailableInstructors?id={!Lesson__c.Id}&Date_c={!Lesson__c.Lesson_Date__c}
There are a few other issues i'm having with this page, but the most critical is inserting the Instructor__c onto the Lesson Record. I'm trying to stay away from apex, since this will need to be maintained by a non-profit without developer resources.
URLFOR is an odd duck in that it doesn't support dynamic parameters or merge fields as parameters. Instead, the alternative would be something like
Alternatively, you could figure out the Flow URL in Apex and return a PageReference with the appropriate parameters.
Thanks James (great name!) So here's what i tested: However the flow is still not picking up the varInstructorId. Will this not be possible using this method?