function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AndrewFisher_TGPAndrewFisher_TGP 

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) 
Hi AMG_SFDC,

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

https://rakeshistom.wordpress.com/2015/06/24/getting-started-with-process-builder-part-30-auto-generate-renewal-opportunity-with-line-items/

Best Regards
Naga Kiran