My recent post on bypassing validation rules (WHAT CONDITION YOUR VALIDATION IS IN) generated a record number of comments. It is all kinds of awesome to know that folks are reading the blog AND asking questions.
Two comments in particular were around pushing the userID over to the flow. After much facepalming, I realized that I never really explained how to do that.
There are actually a couple of ways of pushing data to a flow, however, I am going to share with you all my absolute favorite ways of doing this that you can also apply to all sort of other situations. In true “SFDCinSEA” fashion we are going to take the well documented idea of a pushing data in a URL (Best write up EVER!) , applying that notion to flows (From the Source!) and throwing in a bit of a curve ball by doing all this from a formula field (Evil laugh goes here!).
To do this, you will need the following:
- A flow
- A flow variable for the running user (varUserId)…What was actually asked about in the comments
- A flow variable for the accountid (VarPassedAccountID)…Just because I can
- A Hyperlink field
The basic premise is that we are going to use the hyperlink to launch the flow. When the user clicks on the hyperlink, it will pass over the accountID and running UserId.
Enough build up…here is what it looks like:
“Hyperlink(“/flow/validation_rule?varUserID=”&$User.Id&”&varPassedAccountID=”&Id,”Validation Rule Update”)”
Hmmm, that was really anticlimatic..wish there was a way to kick that up a notch, but there really isn’t…this is just a good use of the tools salesforce gives us!
Here it is sitting there looking awesome on the layout.
And here is proof that the values are passing!
And yes, yes I am passing two values over to the flow.
You can even use similar type of functionality if you decide to use a button.
One of the reasons I like doing this in a hyperlink field though is that I can change dynamically how this field is presented. For instance, I could use an image field to change how this looks based on some criteria. I could even “mask” the data by looking at the running user. Heck, I could even change which flow is actually running!
Enjoy, and keep the dialogue going!