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
Rohit Vaidya 3Rohit Vaidya 3 

flows and triggers

can we write half of the logic using apex triggers and half using flows, if yes then how can we achieve that and will it impact the performance and complexity?
SwethaSwetha (Salesforce Developers) 
HI Rohit,
Based on my understanding, yes, you can write half of the logic using Apex triggers and half using flows in Salesforce. 

1. Create an Apex trigger that performs the initial logic.
2. In the Apex trigger, call a flow.(See Calling Flow from Apex :https://andyinthecloud.com/2014/10/26/calling-flow-from-apex/)
3. In the flow, perform the remaining logic.

See related: https://salesforce.stackexchange.com/questions/352972/structural-question-record-triggered-flow-and-apex-trigger-together

https://www.crmscience.com/single-post/invoking-apex-with-flow-using-salesforce

Combining triggers and flows will increase the complexity of your implementation, If the flow is too complex, it can cause performance/maintenance problems. It's important to have a clear understanding of the logic and maintain consistency between the trigger and flow.

If this information helps, please mark the answer as best. Thank you
Arun Kumar 1141Arun Kumar 1141
Hello Rohit,

Yes, it is possible to divide the logic between Apex triggers and flows in Salesforce. This approach can be useful when you want to leverage the strengths of both technologies. Apex triggers offer greater flexibility and can handle complex business logic, while flows provide a declarative and visual way to design and automate processes.

For more detailed information, check out here
https://www.crmscience.com/single-post/invoking-apex-with-flow-using-salesforce#:~:text=Invoke%20Apex%20From%20Flow.&text=After%20collecting%20the%20data%20or,parameters%20as%20variables%20you%20defined.

I hope it will help!
Thanks.