2

I have a junction object of Oppty and a custom object (say license).

Once the oppty is in stage closed won, the rep needs to enter a set of licenses to that oppty.

enter image description here

The rep needs to enter the license name, and for each of the license, the junction object will be created, so an oppty can have any number of licenses. (p.s. a license can be in any number of opptys)

In my flow, I am able to do that for a single object with ease

Get the correct oppty id and license name, lookup the license id, create junction object.

enter image description here

I don't have a clue no how to do that in a way, that is dynamic. I need a way, that the sales rep will either enter the number of licenses to add to the oppty, and the flow will support that, or the sales rep will enter the license numbers directly. (it can be from 1 to 20 licenses per oppty)

The options I had in mind:

  1. Start with number variable and somehow loop according to that variable
  2. Parse a long text area

How can I achieve that?

1 Answer 1

3

I think you are on the right path with the idea of looping in the process.

Here's what I would do, but note, you'll need to likely add some more user screens since this is a simplified example.

You'll need to have an sObject Collection variable in your flow.

  1. Go through intial user screens to collect information
  2. User then searches for license by name/search term
  3. User selects the desired license
  4. Flow creates license assignment, and saves to sObject variable (myLicense)
  5. myLicense is added to sObject Collection (myLicenses)
  6. User is asked "Do you need to assign more licenses?"
  7. If yes, begin the process again with the search screen
  8. If no, have flow run Fast Create and reference myLicenses so it's only 1 DML statement

Screenshot below:enter image description here

2
  • Can you elaborate please on how to use the single DML? I only manage to do it with DML for every object.
    – Saariko
    Commented Jun 3, 2015 at 11:46
  • My mistake, I overlooked the detail. You'll need to use an "Assignment", not "Record Create" and set the individual field vaules for the myLicense. Next, use another "Assignment" and select the variable myLicenses and "add" myLicense to this sObject Collection. From here, you can run a "fast Create" and pass in the sObject Collection called myLicenses.
    – James
    Commented Jun 3, 2015 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .