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
mohammad sohail01mohammad sohail01 

public without sharing class comm{

public without sharing class comm {
public void inititaie(set<string> setid, list<applicable_account__c> lstapp,
                             map<string,map<string,wrapemail>> mapiddlistobj){
 code to generate email template and send emails to fetched account details
};};
the above method is synchronous non-static parametrized method which is throwing issue "apex CPU Time limit exceed exception" to overcome the issue how to make the above method to asynchronous method.
Nishant SoniNishant Soni
Hi, 

To address the "Apex CPU Time limit exceed exception" and make the method asynchronous, you can use the @future annotation in Salesforce. The @future annotation allows you to run the method asynchronously in the background, which can help prevent CPU time limit exceeded exceptions.
 
For future method, you can refer to this link https://www.apexhours.com/future-method-in-salesforce/

Thanks,
Nishant
mohammad sohail01mohammad sohail01
But my method is non-static and parameterized which having list and map collections where the future method doesn't work.