+ Start a Discussion
Paul TolentinoPaul Tolentino 

Please check the code and help me to improve the code coverage %.

In our Org, we are creating a new account via API directly without creating a lead. And to assign the account we did a custom coding for auto-assignment to Users.

In Auto-assignment APEX code we used two custom objects. - User_Assignment__c (Vlookup relationship with User object). - Account_Allocation_Master__c (Master-detail relationship with User_Assignment__c object).

The below APEX code will Generate ownerid for every new account after insert and I am getting a code coverage issue while deploying in production.
AbhishekAbhishek (Salesforce Developers) 
Hi Paul,

Unfortunately, it is very difficult for us to debug the above code.

Code coverage indicates how many executable lines of code in your classes and triggers have been exercised by test methods. ... To deploy Apex or package it for the Salesforce AppExchange, unit tests must cover at least 75% of your Apex code, and those tests must pass.

For your reference, you can check the below articles,



I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Paul TolentinoPaul Tolentino
Thank you for the update.  I will share this information to our Client.