5

I have a Screen in my visual work flow containing multi-select picklist with dynamic options (records of another custom object CustomObj1).

And CustomObj2 looks up to CustomObj1 in the data model.

When the user selects the multiple values from the multi-select picklist and hits Next, I want to create record of CustomObj2 for each selected multi-select pick list value.

So for example if the multi-picklist has A, B , C, D (which are records of CustomObj1). The user chose A; C; D. Then when he clicks Next, it would create 3 records of CustomObj2 with lookup to A, C and D.

I know this is easily achievable using a visualforce page and a controller. But can this be done in a visual work flow?

Appreciate your help.

  • You do realize you can use custom controllers in Flows don't you? You could possibly also do this where clicking "next" does a Save to CustomObj2. Problem you'd run into is that I don't think you could use workflow to transfer the values via a formula look-up because you couldn't use that method with pick list values and I assume you need to concatenate them into a string. – crmprogdev Jun 30 '14 at 23:20
  • I am to facing the same issue. Can anyone please help me out with this – user10583 Jul 23 '14 at 9:39
1

You can try the solution I wrote up here: Visual Workflow - Create multiple records based on dynamic choices

You have to assign the multi-select into a variable and store it on Obj1. It will be a text value with SalesForce IDs in it, separated by semicolons. You then have a trigger run through that string and create a detail record for each one.

1

Just came across a brilliant approach on the dev forums that makes this easy - no trigger required.

See: https://developer.salesforce.com/forums/?id=906F0000000AntQIAS

The dynamic choice stores the IDs of the selected records to a semicolon delimited text string.

Joe cook's solution adds an additional fast lookup with the same criteria as the dynamic choice. The results of the lookup are assigned to a sObject collection.

Then you loop through the sObject collection and evaluate if the text string contains the loop record ID. If yes, (do something) else skip.

I am using a flow to copy attachments from email to the parent case. This allowed me to add a screen where the user can select which attachments to copy, if there are more than 1 attached to the email. This approach is working perfectly.

0

That should work using a Dynamic choice in the Flow: https://help.salesforce.com/HTViewHelpDoc?id=vpm_designer_elements_screen_dynchoice.htm&language=en_US

Here is a developerforce blog that will walk you through something like what you want to do: https://developer.salesforce.com/blogs/developer-relations/2012/09/visual-workflow-freedom-of-choice.html

  • I have already got my dynamic choice picklist working. After clicking Next I get the selected choices in a semi-colon separated string. My question is, how can I create a record for each choice selected, where the choice is the lookup. – codeinprogress Jul 1 '14 at 13:12
  • Did you try using a formula to separate the values? – snugsfbay Jul 2 '14 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.