+ Start a Discussion

How to add opportunity line item on flow to add to process builder

I am trying to add a new flow to a process builder which is to create an opportunity line item with defaulted price book and a defaulted product. I have created the opportunity and contact roles but now need the Opportunity line item. I want it to add when a field is checked (process builder cn do that bit so all ok there) but cannot get the flow to work 

Any help would be appreciated !
NagaNaga (Salesforce Developers) 

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. Before proceeding ahead, you have to understand OpportunityLineItem objects in Salesforce. OpportunityLineItem represents an opportunity line item, which is a member of the list of Product2 products associated with an Opportunity. Follow the below instructions to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create few Text variables VarT_AccountId, VarT_OldOpportunityId, VarT_NewOpportunityId, VarT_PricebookId andVarT_OldOpportunityName to store the Account Id, old Opportunity Id, new Opportunity Id, existing Opportunity Price Book Id and old Opportunity Name respectively.
3. The next step is to get all the Opportunity Line Items from the existing opportunity. To do this drag-and-drop Fast Lookup element (Enter the name To get all Line Items from existing opportunity) onto the canvas and map the fields according to below details

Please see the link below for more info


Best Regards
Naga Kiran