I have a screen flow that I'd like users to be able to access two different ways: from a field on the Opportunity Product object, as well as a Detail Page Button. What's paramount is where the screen flow returns at its end: I need it to end on a view of the product related list on the related Opportunity record. I got it to work successfully on the field version. Here's my formula field:
HYPERLINK("/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product" &"?recordId=" &Id &"&retURL=/lightning/r/Opportunity/" & OpportunityId & "/related/OpportunityLineItems/view",
"CLONE",
"_self"
)
But for the life of me, I can't get the Button version of the URL to go back to the Product related list. I figured out that I can't reference the Opportunity Id via merge field in this scenario, so I created a formula field called Opportunity_Id__c, which just utilizes a CASESAFEID version of the Opportunity Id.
In order to save time, here is a list of the various versions I've tried that DON'T work:
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/{!OpportunityLineItem.Id}
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/Opportunity/&OpportunityId&/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/Opportunity/OpportunityLineItem.Opportunity_Id__c/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/Opportunity/{!Opportunity.Id}/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/Opportunity/{!OpportunityLineItem.Opportunity_Id__c}/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/Opportunity/&OpportunityLineItem.Opportunity_Id__c&/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/OpportunityLineItem.Id}
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/{!OpportunityLineItem.Opportunity_Id__c}/related/OpportunityLineItems/view
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
OpportunityLineItem.Id}&retURL=/lightning/r/&OpportunityLineItem.Opportunity_Id__c&/related/OpportunityLineItems/view
Anyone have any thoughts, tips, or suggestions?
#Flow #Flows #Screen Flow #Formulas
,
Thank you for the suggestion. I tried that, exactly as you laid out, but it still did not work.
I am happy to announce, however, that I spoke with Salesforce support on Friday and they did get it to work. Confusingly, it was one of the options I had tried before, which is in the list of my original post.
This is the URL that worked:
/flow/Opportunity_Product_Screen_Flow_Clone_Opportunity_Product?recordId={!
}&retURL=/lightning/r/Opportunity/{!OpportunityLineItem.Opportunity_Id__c}/related/OpportunityLineItems/view