You need to sign in to do that
Don't have an account?
Sonu G
i want to automate the opportunity renewal process by copying opportunity along with opportunity products.
Hi guys, my requirement is,
Create Renewal Opportunity - When opportunity stage is set to “Closed Won”, renewal
opportunity needs to be created with the following field mapping
Record type = “Renewal” (Create Opportunity Record Type, if not exist)
Account = Account of Original Opportunity
Type = Type of Original Opportunity
Stage = “Negotiation/Review”
Renewed from Opportunity = Original Opportunity (Create Lookup field of Opportunity on
Opportunity)
Close date = Close date of Original Opportunity + 10 Days
Name = “Renewal” + [SPACE] + Original Opportunity Name
2. Copy opportunity line Item to the renewal opportunity from Original Opportunity
Create Renewal Opportunity - When opportunity stage is set to “Closed Won”, renewal
opportunity needs to be created with the following field mapping
Record type = “Renewal” (Create Opportunity Record Type, if not exist)
Account = Account of Original Opportunity
Type = Type of Original Opportunity
Stage = “Negotiation/Review”
Renewed from Opportunity = Original Opportunity (Create Lookup field of Opportunity on
Opportunity)
Close date = Close date of Original Opportunity + 10 Days
Name = “Renewal” + [SPACE] + Original Opportunity Name
2. Copy opportunity line Item to the renewal opportunity from Original Opportunity
You can achieve the above mentioned requirements with the use of Process builder where in which it will call a autolaunched flow given that record type and additional lookup fields are already configured.
Write bulkified logic in an Apex class and call it from Opportunity trigger 'after update' context.
Filter Opportunities records that are closed-won, get related Order Products, and create new recods.
Handling this use case with Process builder + Flow will results in SOQL query limit error, as flows are not bulkified and multiple queries will be fired when the trigger context will have multiple Opportunities matching the criteria.
If this helps solve your issue, please mark this as Best Answer, so that others can benefit too in future.
Hi Mrltzl & Sonu
What i feel is Process Buildder will be quite easy and will not require Apex classes. With Process Builder you will just need to assign the values of Opportunity and that's it. As we will not need to bulkify this thing. This will run on an opportunity getting closed won, and there will be rare cases where 1000s of opportunity will be converted to closed won.
In case of process builder just create a criteria check about Stage being changed to Closed Won. Then create a new Record of Opportunity type and map the fields accordingly.
Hope i was able to solve your query.
Regards,
Somya Tiwari
Such operations hit limits very quickly if not bulkified, so if its target to be deployed in a Production system, its always recommended to implement a scalable solution (with bulkified query & DML operations).
If its just for practice in a developer org, then no worries.
thank you