You need to sign in to do that
Don't have an account?
Tasia Demuth 4
MultiAdd Action in VF page
I have a visualforce page that calls a flow that creates an opportunity. I would like the finish location to be the multiadd action, so the user can add products to the newly created opportunity.
Here is my code so far. Any suggestions?
<apex:page standardController="Opportunity" recordSetVar="opportunities">
<flow:interview name="CreateOpportunityFlow" finishLocation="<apex:outputLink>{!URLFOR($Action.OpportunityLineItem.MultiAdd)}</apex:outputLink>">
<apex:param name="AccountId" value="{!$CurrentPage.parameters.Id}"/>
</flow:interview>
</apex:page>
Here is my code so far. Any suggestions?
<apex:page standardController="Opportunity" recordSetVar="opportunities">
<flow:interview name="CreateOpportunityFlow" finishLocation="<apex:outputLink>{!URLFOR($Action.OpportunityLineItem.MultiAdd)}</apex:outputLink>">
<apex:param name="AccountId" value="{!$CurrentPage.parameters.Id}"/>
</flow:interview>
</apex:page>
Get Flow Variable Values to a Visualforce Page: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_getting_values.htm
Configure the finishLocation Attribute in a Flow: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_finishlocation.htm
The actions are a restrictted list: https://help.salesforce.com/articleView?id=dev_action_values.htm&language=en&type=0
I didn't find "MultiAdd" but the compilation is OK with this action so that must work and the list is out-of-date.
Anyway, the following POC needs a controller (without using "MultiAdd").
The record ID of the created opportunity is assigned to {!flow_oppid}
But we need an output variable : oppId
That works.
Regards
Alain
All Answers
Get Flow Variable Values to a Visualforce Page: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_getting_values.htm
Configure the finishLocation Attribute in a Flow: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_finishlocation.htm
The actions are a restrictted list: https://help.salesforce.com/articleView?id=dev_action_values.htm&language=en&type=0
I didn't find "MultiAdd" but the compilation is OK with this action so that must work and the list is out-of-date.
Anyway, the following POC needs a controller (without using "MultiAdd").
The record ID of the created opportunity is assigned to {!flow_oppid}
But we need an output variable : oppId
That works.
Regards
Alain
This is awesome! I do run into one issue. My URL keeps routing to this: https://cs50.salesforce.com/p/opp/SelectSearch?addTo=null&retURL=%2Fnull
Null is populating instead of the id. When I replace null with the id manually it works really well! Do you know why I might not be automatically getting the ID set into that url?
Thanks for your help!!
Tasia
The workflow can be simplified using OppId directly as shown below ( you have probably changed that yet ).
If you run the workflow directly (button "run") that doesn't work when you click "finish".
You always need to launch the workflow from the VFP as you have done ( /apex/myVFPname )
Could you show me your controller?
You could need something more suitable for your need.
<apex:page standardController="Opportunity" recordSetVar="opportunities">
The sample is very simple and my custom controller is sufficient for the basic test but you have used a standard controller for a list (more complex).
Best regards
Alain
You were right. I had not set the variable oppId in the flow correctly. I got it running smoothly.
I really appreciate your help!
Tasia
I am wondering if you can help me with one more thing related to this question.
We are moving over to lightning and I would like to redirect to the Lightning version of MultiAdd instead of the classic. Is there a way to do this?
I think the code I need to change is below:
PageReference send = new PageReference('/p/opp/SelectSearch?addTo=' + returnId + '&retURL=%2F' + returnId);
Let me know.
Thanks!
Tasia