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
V R 9V R 9 

Opportunity Trigger

Business requirement - We have a bulk upload job that upserts account records daily. Once the account has met a specific criteria an opportunity should be auto generated with the owner from the account team. 

Question:
Would trigger be the best way to go about this? Are there any gotchas(with bulk account updates) that I should watch out for? Any other method to build this scenario more efficiently?
Best Answer chosen by V R 9
dburks_gooseheaddburks_goosehead
You should be able to do this with a headless flow.  Your flow will contain a record create element where you can populate the fields you want and set values to either constant values or variables.  You then make a workflow rule to fire your flow when an account reaches the desired stage.

All Answers

Zuinglio Lopes Ribeiro JĂșniorZuinglio Lopes Ribeiro JĂșnior
Hello,

It depends of the volumetry of records are you going to upload at once. For high volume of records I would not recommend using triggers as they are synchronous. In that case, I would go for asynchronous techniques to avoid hitting Governor Limits. Find more about in: https://www.youtube.com/watch?v=ZqqiIg_mynY (https://www.youtube.com/watch?v=ZqqiIg_mynY" target="_blank)

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm" target="_blank)

Regards.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
dburks_gooseheaddburks_goosehead
You should be able to do this with a headless flow.  Your flow will contain a record create element where you can populate the fields you want and set values to either constant values or variables.  You then make a workflow rule to fire your flow when an account reaches the desired stage.
This was selected as the best answer
V R 9V R 9
The headless flow worked best for our use case. Thank you.