You need to sign in to do that
Don't have an account?
Yelper Dev
Help with a test class on VF Page (Extension)
Hello,
Need some help in creating test class for the following extension bellow. I am using an Account standardcontroller.
Thank you!
Need some help in creating test class for the following extension bellow. I am using an Account standardcontroller.
public class GetContactFromAccount { public Contact contact {get;set;} public Account account {get;set;} private final ApexPages.StandardController controller; public getContactFromAccount(ApexPages.StandardController controller){ this.controller = controller; account = (Account)controller.getRecord(); contact = new Contact(); } public PageReference save(){ insert account; contact.MailingStreet = account.BillingStreet; contact.MailingCity = account.BillingCity; contact.MailingState = account.BillingState; contact.MailingPostalCode = account.BillingPostalCode; contact.MailingState = account.BillingCountry; contact.AccountId = account.Id; contact.Type__c = 'Subscriber'; insert contact; Pagereference pageRef = New PageReference('/'+account.Id); System.debug(contact); return pageRef; } }
Thank you!
All Answers
https://help.salesforce.com/articleView?id=000002839&type=1