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
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.
https://docs.google.com/document/d/1OfH85kXBi9YrRMs02PR1WPKuwMbehmLr5Psr6SDM6ZI/edit?usp=sharing
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,

https://help.salesforce.com/articleView?id=code_dev_console_tests_coverage.htm&type=5

https://help.salesforce.com/articleView?id=000330173&type=1&mode=1

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

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