• Harold Carlson
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies

I'm sure this is simple for most but I can't seem to figure out how to write a test class for a very simple custom class.  This will truly show how much I don't know how to code so I'm hoping someone will help me.

Here's my controller:

public class AccountTeamMemberController {
    
    public List<AccountTeamMember> atmList {get; set;}
    public AccountTeamMemberController(ApexPages.StandardController controller) {
        Account acc = (Account) controller.getRecord();
        
        atmList = [SELECT Id, AccountAccessLevel, AccountId, Account.Name, TeamMemberRole,UserId, User.Name FROM AccountTeamMember where AccountId =: acc.Id];
    }

}
Here's my test class that has the compile error:
@isTest
public class AccountTeamMemberControllerTest {

    @isTest
    static void testATMController() {
   
    List<AccountTeamMember> teamList=new List<AccountTeamMember>();
   
    User uUser1 = [Select Id from user where user.name = 'Jane Doe' Limit 1];
    User uUser2 = [Select Id from user where user.name = 'John Doe' Limit 1];
        
    RecordType accRT = [select id,Name from RecordType where SobjectType='Account' and Name='Customer' Limit 1];
   
    // Create the Acount
    Account aAccount = new Account();
    aAccount.Name='Test123';
    aAccount.Owner=uUser1;
    aAccount.RecordTypeID=accRT.id;
    aAccount.Account_Subtype__c='Subscription';
    aAccount.Industry='Construction';
    aAccount.Marketing_Vertical__c='Construction';
    aAccount.Website='http://www';
    aAccount.LMS_Current__c='EH&S Platform';
    aAccount.Active__c='Yes';
    aAccount.BillingCity='New York City';
    aAccount.BillingState='New York';
    
    insert aAccount;
       
    //Create the AccountTeam
    AccountTeamMember ATM1 = new AccountTeamMember();
    ATM1.AccountId = aAccount.ID;
    ATM1.TeamMemberRole = 'Owner';
    ATM1.UserId = uUser1.ID;
        
    teamList.add(ATM1);
    
    AccountTeamMember ATM2 = new AccountTeamMember();
    ATM2.AccountId = aAccount.ID;
    ATM2.TeamMemberRole = 'Co-Owner';
    ATM2.UserId = uUser2.ID;
        
    teamList.add(ATM2);
    
    if(teamList != null) { insert teamList; }
       
    Test.StartTest();
    
    PageReference pageRef = Page.Account_Team; //VF page
    Test.setCurrentPage(pageRef);
       
    AccountTeamMemberController tp = new AccountTeamMemberController();
    tp.RefreshPage();
    
    Test.StopTest();

    }
}

 

Hi all,

I am integrating Outlook with Salesforce where in I am facing an issue when I am composing an email with attachment in it, I select the tab of Log Email on send but it doesn't display the attachment of the mail in salesforce.

 I am attaching an image which decpicts the exact sitauion I am facing.

Kindly reply if anyone has worked on the same.

Thank you in advance!
User-added image  

I'm sure this is simple for most but I can't seem to figure out how to write a test class for a very simple custom class.  This will truly show how much I don't know how to code so I'm hoping someone will help me.

Here's my controller:

public class AccountTeamMemberController {
    
    public List<AccountTeamMember> atmList {get; set;}
    public AccountTeamMemberController(ApexPages.StandardController controller) {
        Account acc = (Account) controller.getRecord();
        
        atmList = [SELECT Id, AccountAccessLevel, AccountId, Account.Name, TeamMemberRole,UserId, User.Name FROM AccountTeamMember where AccountId =: acc.Id];
    }

}
Here's my test class that has the compile error:
@isTest
public class AccountTeamMemberControllerTest {

    @isTest
    static void testATMController() {
   
    List<AccountTeamMember> teamList=new List<AccountTeamMember>();
   
    User uUser1 = [Select Id from user where user.name = 'Jane Doe' Limit 1];
    User uUser2 = [Select Id from user where user.name = 'John Doe' Limit 1];
        
    RecordType accRT = [select id,Name from RecordType where SobjectType='Account' and Name='Customer' Limit 1];
   
    // Create the Acount
    Account aAccount = new Account();
    aAccount.Name='Test123';
    aAccount.Owner=uUser1;
    aAccount.RecordTypeID=accRT.id;
    aAccount.Account_Subtype__c='Subscription';
    aAccount.Industry='Construction';
    aAccount.Marketing_Vertical__c='Construction';
    aAccount.Website='http://www';
    aAccount.LMS_Current__c='EH&S Platform';
    aAccount.Active__c='Yes';
    aAccount.BillingCity='New York City';
    aAccount.BillingState='New York';
    
    insert aAccount;
       
    //Create the AccountTeam
    AccountTeamMember ATM1 = new AccountTeamMember();
    ATM1.AccountId = aAccount.ID;
    ATM1.TeamMemberRole = 'Owner';
    ATM1.UserId = uUser1.ID;
        
    teamList.add(ATM1);
    
    AccountTeamMember ATM2 = new AccountTeamMember();
    ATM2.AccountId = aAccount.ID;
    ATM2.TeamMemberRole = 'Co-Owner';
    ATM2.UserId = uUser2.ID;
        
    teamList.add(ATM2);
    
    if(teamList != null) { insert teamList; }
       
    Test.StartTest();
    
    PageReference pageRef = Page.Account_Team; //VF page
    Test.setCurrentPage(pageRef);
       
    AccountTeamMemberController tp = new AccountTeamMemberController();
    tp.RefreshPage();
    
    Test.StopTest();

    }
}

 
Dear all,

I am new to Salesforce. I created a developer environment, and a test Connected App, so that I can test making REST API calls.
The problem is that I cannot locate the consumer key and consumer secret for my app. I have read people had similar issues in the past, but their solution didn't work for me.
I attach a screenshot of my app details. According to the docs, this is where I should see consumer key and consumer secret.

User-added image

Thanks for the help!

Daniele 
I'm the administrator for Salesforce in our department and I'm VERY new to this, so any help is greatly appreciated. I added a new picklist value to the existing picklist in the Custom field. I ensured it's showing in each Record type as well. The Field accessibility and field-level security seem to be set correctly. The pick list values that were already there are still visible, it's just the one I added is not. What am I missing? 

does anyone know of a way to make this work?  Currently the PDF populates with the HTML.

I am getting Insufficient privileges issue when visualforce page is accessed on a tab.

Actually, the Visualforce page overrides the standard tab of custom object.

 

I have checked all the custom object permissions on the profile and made sure that Visualforce page and Apex classes are enabled for the profile.

The strange thing is that, when i turn on the View Setup and Configuration permission in the profile, the Visualforce page gets rendered well without any issue.

But i don't want that permission to be turned on.

 

If i turn off, i get the same issue.

 

Any thoughts?

Appreciate any help on this.

Create a formula field on the cases object called "Reference"

 

with the following formula

 

"[ ref:???????.????" & SUBSTITUTE( RIGHT(Id,11) , "0", "") & ":ref ]"

 

Replacing the ?? with the data from one of your own ref records.

The Red ?? you can copy directly from one of your own Ref records

The Blue ?? are the first 4 of the Case ID which doesn't change

 

 

Once you've created this field you can add it to workflow email templates on the subject line and it will basicly do what SF does when you email out from a case

 

You can also copy  this Reference when someone sends you an offline email and forward it to your support email with the Ref pasred in the subject line and it will attach that email to your case.

I am a bit of a beginner at formulas, so hopefully one of you will think this is easy, and be able to help. :-)

 

Customer requirement:

 

Create a formula field that displays the Week Number (as Week 1, Week 2, etc), based on the Date entered on a particular record (same object).

 

Ex: 01/01/09 - 01/04/09 would return a value of "Week 1"  

01/05/09 - 01/11/09 = Week 2

01/12/09 - 01/18/09 = Week 3

 

and so on.....

 

Is using the CASE function the way to go, and if so, what's the shortest way to create this formula?

 

Thank you in advance!

S

 

  • April 20, 2009
  • Like
  • 0