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

How to write unit test for Salesforce organizations with required custom fields



In the unit test of my AppExchange application has the following code segment to create an account to test the bahaviour of the application.

    Account newAccount = new Account(); = 'OPRO_TEST';

This unit test worked fine with any Salesforce organization which does not have custom fields which have required attribute set to true in the Account salesforce object. This kinds of unit test fails when there are such custom  fields in the Salesforce organization.

Do you have a solution for this kind of problem ?