• Dorel Nasso 9
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 18
    Replies
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.  
  
 
Can you please confirm if this is possible? I have a Custom Object called Advisor Contacts on the Related Lists on the Account. I have another Custom Object Client Advisor Roadmap that is also on the Account's Related Lists and has Advisor Contact on the Roadmap's related list. I do not want the users to have to create the related list twice. Is there a way to map over the values from the Account's Advisor Contact to the Account's Client Advisor Roadmap's Advisor Contacts using Flow? I just want to confirm this is the correct path. Thank you, 
Dorel
IF(MOD([MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c   - DATE(1900,1,14),7)<5, [MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c  - 80, 

(CASE(MOD( TODAY()- DATE(1900,1,14),7), 
5, TODAY()+ 3, 
6, TODAY()+ 2, 
7, TODAY()+ 1, 
TODAY() ) ))

Then I tried 
CASE(MOD( MPM4_BASE__Project_Lookup__r.Go_Live_Date__c - DATE(1900,1,7),7), 
0,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
1,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
2,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
3,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
4,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
5,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
6,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+1)), 
MPM4_BASE__Project_Lookup__r.Go_Live_Date__c -80)

Please  let me know what I am doing wrong?  I entered 1/1/2019 as the Go Live Date and I still get 10/13/2018 ?

Thank you,
Dorel
I am trying to create a image field flagging when an opportunity is behind schudule.  I am using the stage field and a custom field of "# of days in Process" in the formula.  The Days field is also a formula from when the opportunity is received.  I can get the formula to work with the first condition but I can not add other stages to the formula.

IF(AND (ISPICKVAL ( StageName, "Received"), of_Days_in_Process__c  <= 2), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Strategy"), of_Days_in_Process__c  <= 3), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Devlopment"), of_Days_in_Process__c  <= 5), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Assembly"), of_Days_in_Process__c  <= 6), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)))     

I keep getting error message for ",", IF, And.  Please advise what I am doing wrong.

Thank you,
Dorel    
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.  
  
 
Can you please confirm if this is possible? I have a Custom Object called Advisor Contacts on the Related Lists on the Account. I have another Custom Object Client Advisor Roadmap that is also on the Account's Related Lists and has Advisor Contact on the Roadmap's related list. I do not want the users to have to create the related list twice. Is there a way to map over the values from the Account's Advisor Contact to the Account's Client Advisor Roadmap's Advisor Contacts using Flow? I just want to confirm this is the correct path. Thank you, 
Dorel
IF(MOD([MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c   - DATE(1900,1,14),7)<5, [MPM4_BASE__Milestone1_Project__c].Go_Live_Date__c  - 80, 

(CASE(MOD( TODAY()- DATE(1900,1,14),7), 
5, TODAY()+ 3, 
6, TODAY()+ 2, 
7, TODAY()+ 1, 
TODAY() ) ))

Then I tried 
CASE(MOD( MPM4_BASE__Project_Lookup__r.Go_Live_Date__c - DATE(1900,1,7),7), 
0,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
1,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
2,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-80), 
3,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
4,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
5,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+2)), 
6,(MPM4_BASE__Project_Lookup__r.Go_Live_Date__c-(80+1)), 
MPM4_BASE__Project_Lookup__r.Go_Live_Date__c -80)

Please  let me know what I am doing wrong?  I entered 1/1/2019 as the Go Live Date and I still get 10/13/2018 ?

Thank you,
Dorel
I am trying to create a image field flagging when an opportunity is behind schudule.  I am using the stage field and a custom field of "# of days in Process" in the formula.  The Days field is also a formula from when the opportunity is received.  I can get the formula to work with the first condition but I can not add other stages to the formula.

IF(AND (ISPICKVAL ( StageName, "Received"), of_Days_in_Process__c  <= 2), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Strategy"), of_Days_in_Process__c  <= 3), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Devlopment"), of_Days_in_Process__c  <= 5), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)),

IF(AND (ISPICKVAL ( StageName, "Assembly"), of_Days_in_Process__c  <= 6), IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BF",'Green', 30, 30),IMAGE("/servlet/servlet.FileDownload?file=0151F000000A3BN",'Red', 30, 30)))     

I keep getting error message for ",", IF, And.  Please advise what I am doing wrong.

Thank you,
Dorel