-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
5Replies
Test coverage for url in Pagereference method with if statement
Hi everyone!
I am trying to test this code to obtain 100% coverage, but i can't figure out the problem. When i test it, I don't get an error but the code is still not 100%, kindly seeking your help, Thank you!
Code:
public Pagereference newPage() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
String url = 'https://bitwisecommunity.force.com/instructorportal/CohortianRoster?id=' + classId;
if(classType == cohortRecordTypeId) {
url += '&type=Cohort';
}
return new PageReference(url);
}
Test Class:
static testMethod void testPagereference(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
Test.startTest();
// String cohRecordType = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
PageReference pref = Page.CohortianSelector;
Test.setCurrentPage(pref);
pref.getParameters().put('id',newClass.Id);
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
CohortianSelectorController myPage = new CohortianSelectorController(sc);
myPage.newPage();
Test.stopTest();
}
- Temesgen
- December 01, 2020
- Like
- 0
- Continue reading or reply
Test Coverage for Pagereference method with if statement
I need your assistance to complete test coverage for the following code. How do I add the Pagereference method in my test class and cover the if condition, Thank you!
```
public Pagereference newPage() {
Id classRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Staff').getRecordTypeId();
String url = 'https://ourcommunity.force.com/staffportal/List?id=' + classId;
if(classType == classRecordTypeId) {
url += '&type=Staff';
}
return new PageReference(url);
}
- Temesgen
- November 30, 2020
- Like
- 0
- Continue reading or reply
Apex Test Class with profile
Hello everyone!
I am trying to reach 100% test coverage for the following code, currently it's 88%. I received this error:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Cannot create a portal user without contact: [ContactId]
The profile is a community user profile, how can I solve this problem. Any help would be welcome, thank you.
public class StudentCheckController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public string userProfile;
public StudentCheckController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
userProfile = UserInfo.getProfileId();
System.debug(userProfile);
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
System.debug(cohortRecordTypeId);
// Limit visibility to SSS community user
if(userProfile != '00a7i000000dSK9OOL') {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
System.debug(classes);
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
System.debug(classes);
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/StudentList?id=' + classId);
Pagereference pf = new Pagereference('https://armhat.force.com/coordinatorportal/StudentList?id=' + classId);
return pf;
}
}
Test Class:
@isTest
public class StudentCheckControllerTest {
static testMethod void testGetClassesNotEqualToProfile(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
static testMethod void testGetClassesEqualToProfile(){
UserRole portalRole = [Select Id From UserRole Where PortalType = 'None' Limit 1];
system.debug('portalRole is ' + portalRole);
Profile p = [SELECT Id FROM Profile WHERE Id='00a7i000000dSK9OOL'];
User u = new User(Alias = 'testUser', UserRoleId = portalRole.Id, Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/New_York', UserName='testUser@example.com');
System.runAs(u) {
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
- Temesgen
- November 24, 2020
- Like
- 0
- Continue reading or reply
Apex Test Class with if/else statement for profile
Hello everyone!
I am trying to reach 100% test coverage for the following code, currently it's 88%. Kindly seeking your help, thank you!
public class StudentCheckController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public string userProfile;
public StudentCheckController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
userProfile = UserInfo.getProfileId();
System.debug(userProfile);
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
System.debug(cohortRecordTypeId);
// Limit visibility to SSS community user
if(userProfile != '00a7i000000dSK9OOL') {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
System.debug(classes);
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
System.debug(classes);
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/StudentList?id=' + classId);
Pagereference pf = new Pagereference('https://armhat.force.com/coordinatorportal/StudentList?id=' + classId);
return pf;
}
}
Test Class:
@isTest
public class StudentCheckControllerTest {
static testMethod void testGetClassesNotEqualToProfile(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
- Temesgen
- November 20, 2020
- Like
- 0
- Continue reading or reply
An unexpected error has occurred: Attempt to de-reference a null object
Hello Everyone,
I am new to development, transitioning from Admin. I am tasked to make the Visualforce Page display content from a custom object called Class__c filtered by record type called cohort, so when I used this syntax in the class:
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('cohort').getRecordTypeId();
After that, the Visualforce page is not displaying and gave me this error:
Attempt to de-reference a null object
VF Page code:
<apex:page standardController="Class__c" extensions="CohortianSelectorController" standardStylesheets="false" sidebar="false" showHeader="false">
<style type="text/css">
html body {
font-family: 'Raleway', sans-serif;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-size: 14px;
text-align: center;
color: black;
background-image: url(https://geekwiseacademy.com/wp-content/uploads/2017/04/homepage-background.jpg);
}
.logo-img {
margin-top: 20px;
height: 70px;
}
.my-btn {
background: none;
background-color: rgb(162, 98, 97);
color: white;
font-size: 16px;
padding: 10px 20px 10px 20px;
border: none;
}
.my-btn:hover {
background-color: rgb(142, 62, 64);
}
.classContainer {
border: 2px solid #A11B12;
margin: 10px;
padding: 5px;
}
.colorText {
color: black;
}
</style>
<head>
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" />
</head>
<div class="container-fluid">
<div class="row">
<img src="https://geekwiseacademy.com/wp-content/themes/geekwise_v3/img/geekwise_logo.png" alt="Logo" class="logo-img" />
</div>
<div class="row colorText">
<h2 class="title">Geekwise Academy Instructor Portal</h2>
<p class="sub-title">Select your Class</p>
</div>
<div class="row">
<apex:repeat value="{! class__c}" var="myClass">
<div class="col-md-6">
<div class="classContainer">
<h3>{! myClass.name}</h3>
<apex:outputText value="{0, date, MMMM d',' yyyy}">
<apex:param value="{! myClass.start_date__c}" />
</apex:outputText> -<br/>
<apex:outputText value="{0, date, MMMM d',' yyyy}">
<apex:param value="{! myClass.end_date__c}" />
</apex:outputText> <br/>
<p>{! myClass.class_nights__c}</p>
<apex:form >
<apex:commandLink action="{! newPage}">
<apex:param name="classId" value="{! myClass.Id}" assignTo="{! classId}"/>
<button class="my-btn">View Class</button>
</apex:commandLink>
</apex:form>
</div>
</div>
</apex:repeat>
</div>
</div>
</apex:page>
Class Code:
public class CohortianSelectorController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public CohortianSelectorController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('cohort').getRecordTypeId();
if(userEmail == 'salesforcesupport@shift3tech.com' || userEmail == 'dakina@bitwiseindustries.com' || userEmail == 'agutierrez@shift3tech.com' || userEmail == 'smoreno@geekwiseacademy.com' || userEmail == 'bmily@bitwiseindustries.com' || userEmail == 'ggoforth@bitwiseindustries.com' || userEmail == 'tsolis@bitwiseindustries.com' || userEmail == 'dramos@geekwiseacademy.com' || userEmail == 'iolguin@bitwiseindustries.com' ) {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/classRoster?id='+ classId);
Pagereference pf = new Pagereference('https://bitwisecommunity.force.com/instructorportal/classroster?id=' + classId);
return pf;
}
}
Thank you for your help in Advance.
- Temesgen
- November 19, 2020
- Like
- 0
- Continue reading or reply
Test coverage for url in Pagereference method with if statement
Hi everyone!
I am trying to test this code to obtain 100% coverage, but i can't figure out the problem. When i test it, I don't get an error but the code is still not 100%, kindly seeking your help, Thank you!
Code:
public Pagereference newPage() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
String url = 'https://bitwisecommunity.force.com/instructorportal/CohortianRoster?id=' + classId;
if(classType == cohortRecordTypeId) {
url += '&type=Cohort';
}
return new PageReference(url);
}
Test Class:
static testMethod void testPagereference(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
Test.startTest();
// String cohRecordType = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
PageReference pref = Page.CohortianSelector;
Test.setCurrentPage(pref);
pref.getParameters().put('id',newClass.Id);
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
CohortianSelectorController myPage = new CohortianSelectorController(sc);
myPage.newPage();
Test.stopTest();
}
- Temesgen
- December 01, 2020
- Like
- 0
- Continue reading or reply
Test Coverage for Pagereference method with if statement
I need your assistance to complete test coverage for the following code. How do I add the Pagereference method in my test class and cover the if condition, Thank you!
```
public Pagereference newPage() {
Id classRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Staff').getRecordTypeId();
String url = 'https://ourcommunity.force.com/staffportal/List?id=' + classId;
if(classType == classRecordTypeId) {
url += '&type=Staff';
}
return new PageReference(url);
}
- Temesgen
- November 30, 2020
- Like
- 0
- Continue reading or reply
Apex Test Class with profile
Hello everyone!
I am trying to reach 100% test coverage for the following code, currently it's 88%. I received this error:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Cannot create a portal user without contact: [ContactId]
The profile is a community user profile, how can I solve this problem. Any help would be welcome, thank you.
public class StudentCheckController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public string userProfile;
public StudentCheckController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
userProfile = UserInfo.getProfileId();
System.debug(userProfile);
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
System.debug(cohortRecordTypeId);
// Limit visibility to SSS community user
if(userProfile != '00a7i000000dSK9OOL') {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
System.debug(classes);
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
System.debug(classes);
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/StudentList?id=' + classId);
Pagereference pf = new Pagereference('https://armhat.force.com/coordinatorportal/StudentList?id=' + classId);
return pf;
}
}
Test Class:
@isTest
public class StudentCheckControllerTest {
static testMethod void testGetClassesNotEqualToProfile(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
static testMethod void testGetClassesEqualToProfile(){
UserRole portalRole = [Select Id From UserRole Where PortalType = 'None' Limit 1];
system.debug('portalRole is ' + portalRole);
Profile p = [SELECT Id FROM Profile WHERE Id='00a7i000000dSK9OOL'];
User u = new User(Alias = 'testUser', UserRoleId = portalRole.Id, Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/New_York', UserName='testUser@example.com');
System.runAs(u) {
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
- Temesgen
- November 24, 2020
- Like
- 0
- Continue reading or reply
Apex Test Class with if/else statement for profile
Hello everyone!
I am trying to reach 100% test coverage for the following code, currently it's 88%. Kindly seeking your help, thank you!
public class StudentCheckController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public string userProfile;
public StudentCheckController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
userProfile = UserInfo.getProfileId();
System.debug(userProfile);
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('Cohort').getRecordTypeId();
System.debug(cohortRecordTypeId);
// Limit visibility to SSS community user
if(userProfile != '00a7i000000dSK9OOL') {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
System.debug(classes);
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
System.debug(classes);
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/StudentList?id=' + classId);
Pagereference pf = new Pagereference('https://armhat.force.com/coordinatorportal/StudentList?id=' + classId);
return pf;
}
}
Test Class:
@isTest
public class StudentCheckControllerTest {
static testMethod void testGetClassesNotEqualToProfile(){
class__c newClass = new class__c(name = 'Test Class', class_nights__c = 'Monday / Wednesday', start_date__c = date.today() - 10, end_date__c = date.today() + 45);
insert newClass;
ApexPages.StandardController sc = new ApexPages.StandardController(newClass);
StudentCheckController pc = new StudentCheckController(sc);
pc.userEmail = 'test@gmail.com';
pc.newPage();
pc.userEmail = 'dreyes@armhat.com';
pc.getClasses();
}
- Temesgen
- November 20, 2020
- Like
- 0
- Continue reading or reply
An unexpected error has occurred: Attempt to de-reference a null object
Hello Everyone,
I am new to development, transitioning from Admin. I am tasked to make the Visualforce Page display content from a custom object called Class__c filtered by record type called cohort, so when I used this syntax in the class:
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('cohort').getRecordTypeId();
After that, the Visualforce page is not displaying and gave me this error:
Attempt to de-reference a null object
VF Page code:
<apex:page standardController="Class__c" extensions="CohortianSelectorController" standardStylesheets="false" sidebar="false" showHeader="false">
<style type="text/css">
html body {
font-family: 'Raleway', sans-serif;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-size: 14px;
text-align: center;
color: black;
background-image: url(https://geekwiseacademy.com/wp-content/uploads/2017/04/homepage-background.jpg);
}
.logo-img {
margin-top: 20px;
height: 70px;
}
.my-btn {
background: none;
background-color: rgb(162, 98, 97);
color: white;
font-size: 16px;
padding: 10px 20px 10px 20px;
border: none;
}
.my-btn:hover {
background-color: rgb(142, 62, 64);
}
.classContainer {
border: 2px solid #A11B12;
margin: 10px;
padding: 5px;
}
.colorText {
color: black;
}
</style>
<head>
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" />
</head>
<div class="container-fluid">
<div class="row">
<img src="https://geekwiseacademy.com/wp-content/themes/geekwise_v3/img/geekwise_logo.png" alt="Logo" class="logo-img" />
</div>
<div class="row colorText">
<h2 class="title">Geekwise Academy Instructor Portal</h2>
<p class="sub-title">Select your Class</p>
</div>
<div class="row">
<apex:repeat value="{! class__c}" var="myClass">
<div class="col-md-6">
<div class="classContainer">
<h3>{! myClass.name}</h3>
<apex:outputText value="{0, date, MMMM d',' yyyy}">
<apex:param value="{! myClass.start_date__c}" />
</apex:outputText> -<br/>
<apex:outputText value="{0, date, MMMM d',' yyyy}">
<apex:param value="{! myClass.end_date__c}" />
</apex:outputText> <br/>
<p>{! myClass.class_nights__c}</p>
<apex:form >
<apex:commandLink action="{! newPage}">
<apex:param name="classId" value="{! myClass.Id}" assignTo="{! classId}"/>
<button class="my-btn">View Class</button>
</apex:commandLink>
</apex:form>
</div>
</div>
</apex:repeat>
</div>
</div>
</apex:page>
Class Code:
public class CohortianSelectorController {
public List<Class__c> classes{get; set;}
String dayFormat = 'MM/DD';
public Id classId{get; set;}
public string userEmail{get;set;}
public CohortianSelectorController(ApexPages.StandardController sc) {
userEmail = UserInfo.getUserEmail();
getClasses();
}
public void getClasses() {
Id cohortRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get('cohort').getRecordTypeId();
if(userEmail == 'salesforcesupport@shift3tech.com' || userEmail == 'dakina@bitwiseindustries.com' || userEmail == 'agutierrez@shift3tech.com' || userEmail == 'smoreno@geekwiseacademy.com' || userEmail == 'bmily@bitwiseindustries.com' || userEmail == 'ggoforth@bitwiseindustries.com' || userEmail == 'tsolis@bitwiseindustries.com' || userEmail == 'dramos@geekwiseacademy.com' || userEmail == 'iolguin@bitwiseindustries.com' ) {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active'];
} else {
classes = [ SELECT
id,
name,
class_nights__c,
start_date__c,
end_date__c,
status__c,
class__c,
instructor__r.email
FROM class__c WHERE RecordTypeId = :cohortRecordTypeId AND status__c = 'Active' AND instructor__r.email = :userEmail];
}
}
public Pagereference newPage() {
// Pagereference pf = new Pagereference('/apex/classRoster?id='+ classId);
Pagereference pf = new Pagereference('https://bitwisecommunity.force.com/instructorportal/classroster?id=' + classId);
return pf;
}
}
Thank you for your help in Advance.
- Temesgen
- November 19, 2020
- Like
- 0
- Continue reading or reply