function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue 

Can I start a flow using values from the record where the flow will be published?

We are using a custom App for event ticketing.  When we enter a Membership Opportunity, we need a way to easily create a discount record on our event template, so that when we process a membership we can easily create the discount.

The objects aren't really related in any way, so I can't use a workflow.  My idea was to create a Visual Flow, and then publish that as an Opportunity Detail button.  Once our Membership Coordinator enters the membership, he can click the button to automatically use the values from the Membership Opportunity record to create the discount record in the custom Discount object.

Seems feasible, but I'm not sure how I could access the current record at the beginning of my flow to set the values I would need- like grabbing the Opportunity ID, maybe from the screen URL,  and then looking up the values for that record and creating a new Discount record based on those values.

Suggestions?  Or is this not really a practical approach? Triggers are a bit over my current proficiency, and I'd like to have a reasonable solution sooner than I could teach myself that sort of thing.

TIA, Amanda
Best Answer chosen by Amanda Byrne- Carolina Tiger Rescue
Phil WeinmeisterPhil Weinmeister
Hi Amanda,

You can definitely grab the ID of the record from which the custom button that triggers the flow is clicked. The how is a little more detailed, but I'll give you the basics.

You can create a Variable in your Flow called OpportunityId. Then, you can set your custom button URL to something like this:

/flow/Flow_Name?OpportunityId={!Opportunity.Id}&retURL=/{!Opportunity.Id}

That will your Flow variable to your Opportunity ID.

I hope this helps. I write about this in more detail in my book "Practical Salesforce.com Without Code" (just published), available here: http://www.amazon.com/dp/1484200985

Thanks!
Phil

All Answers

Phil WeinmeisterPhil Weinmeister
Hi Amanda,

You can definitely grab the ID of the record from which the custom button that triggers the flow is clicked. The how is a little more detailed, but I'll give you the basics.

You can create a Variable in your Flow called OpportunityId. Then, you can set your custom button URL to something like this:

/flow/Flow_Name?OpportunityId={!Opportunity.Id}&retURL=/{!Opportunity.Id}

That will your Flow variable to your Opportunity ID.

I hope this helps. I write about this in more detail in my book "Practical Salesforce.com Without Code" (just published), available here: http://www.amazon.com/dp/1484200985

Thanks!
Phil
This was selected as the best answer
Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue
Yay!  I will give that a try!