Skip to main content
I don't know how to write code in Salesforce but after a lot of digging and searching, I found a possible way of adding the Case Creator as a Case Team Member every time a new Case was created. Thus, I copied and paste one in my Sandbox and made the adjustments necessary to make it work for my ORG.

It is working fine in Sandbox, but while trying to deploy it from my sandbox using Change Sets. The trigger is failing with the following error:

"The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage."

As I don't do coding I don't know what I can do in order to be able to move this successfully to my production environment. Any help is really appreciated. 

Thank you,

Erica
4 answers
  1. Jul 23, 2019, 6:49 AM
    Hi Erica,

    Firstly create a 'CaseTeamRole' in your ORG and gave Name = 'Creator' of CaseTeamRole.

    And then try the following test class, it covers 82% code coverage of your code in my ORG.

    @IsTest

    public class AddCaseCreatorasaTeamMember_Test {

        @IsTest

        public static void methodTest1(){

            Id RecordTypeIdCase = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Customer Support').getRecordTypeId();

            Case caseInst=new Case();

            caseInst.Origin='Phone';

            caseInst.Status='New';

            caseInst.recordtypeid=RecordTypeIdCase;

            insert caseInst;

        }

    }

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

    Thanks and Regards,

    Deepali Kulshrestha
0/9000