• Maulik Desai 5
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Stuck in the first module where asked to create a Salesforce Trailhead Playground with Einstein Lead Scoring. I followed all instructions but still getting error. Did anyone else face this issue ? Please help. Screenshots follow.
User-added image

I created a new dev org using the link provided for einstein and the connected it to trailhead but getting error:-
"Sign up for a Trailhead Playground with Einstein Lead Scoring using the link in the instructions."
User-added image
 
Write an Apex trigger for Account when an account is deleted, it should get all primary contacts (found by a custom checkbox field) and disable the primary contacts checkbox field to false.
Hi, I need help with a test class for a trigger.  The trigger works but I can not get the test class to pass.   I need to pull the User ID from the Account Team with the role of Clinical Account Manger.  

Here is the Trigger.
trigger CAM on Case (before update, before insert) 
{
    for (Case myObj : Trigger.new){
        try{
            Id samID = [select UserId from AccountTeamMember where AccountId = : myObj.Account_ID__c and TeamMemberRole = 'Clinical Account Manager' limit 1].UserId;
            
          //string userName = [select Name from User where Id = :samID].Name;
          Id userName = [select Id from User where Id = :samID].Id;
            myObj.Clinical_Account_Manager__c = userName;
        }
        catch(QueryException qEx){
            //Do something if no AccountTeamMember; We chose to send an email to the Account Managers to notify them of the missing data
        }
    }
}
The Test Class is only getting 66% coverage, Lines 8 and 9 of the trigger are not covered.  But I am not how to cover it in the test class.
@isTest
private class CAMTest 
{
static testMethod void TestCase()
{
    Case a = new Case();
    a.AccountId = '0010a00001ELjI2';
    a.Clinical_Account_Manager__c = 'test';
    a.Clinical_Account_Manager__c = 'test';
    update a;
    
    a.AccountId = 'Test';
    a.Clinical_Account_Manager__c = 'test';
    a.Clinical_Account_Manager__c = 'test';
    insert a;
}
    
}

Thank you for anyone suggestions.