Skip to main content
Hi All,

 

I have a situation wherein if a user enters Opportunity product = MI Desktop on an opportunity, there should be 5 specific opportunity products that should be automatically created ( MI Desktop - Energy, MI Desktop - Media, MI Desktop - Metals&Mining, MI Desktop - Real Estate, MI Desktop - Non US FIG). However, if someone enters either of the 5 opportunity products e.g. MI Desktop - Media and then enters MI Desktop, then only other 4 opportunity products should be created(duplicates should not be created).

 

I am thinking to use a Visual Flow and then invoke it through the Process builder. Can someone help me as to how can this be done?

 

Thanks,

 

Aniket
3 Antworten
  1. 15. Mai 2017, 13:55
    Using a Flow is definitely a solid way to do this. The first step is the process builder. You want it to start when an Opportunity Line Item is created and matches one of these names. If that is true, then kick of the Flow. Make sure the Flow is created first so you can point to it in your Process Builder. :)

     

    For the Flow, you want to create a variable for the Opp ID that is the parent of the Opp Line Item that kicked off the PB. Use that ID to search for all Opp Line Items with that ID as their Opp ID. You will want to use a Fast Lookup because you may have 0, 1, or many line items and you need to make sure that your Flow doesn't create a duplicate. Then you make a Loop that takes your collection of line items, takes each one and checks for each of the names, use a Decision element. If it finds one, exit the loop and move onto the next. If it doesn't find one (MI Desktop - Energy) then create the new one with an Assignment element (setting the fields), then another assignment to add each of your Loop Line Items to a collection of New Loop Line Items. Once your loop has processed, then you can use a Fast Create to make all of the line items. 

     

    The above might not be perfect, but it will get you started. Hope it helps. 
0/9000