Day 3 Assignment

I have created 5 days Salesforce based assignment this is third 3rd day I hope you have already finished 1st and 2nd day. If not it is highly recommended to finish the blog-1, and blog-2 part 1 & part 2  first. The assignment is in format of a typical Salesforce requirement, comparable to a small size project. Please go through the requirements which are well defined and should be easily understood if you have a basic understanding of Salesforce sales and service cloud. Your data model design or solution approach to the requirements might be different from the answers provided here. Every solution is correct if you are fulfilling all the requirements.

Requirement: We have a university “St Judes” which wants its salesforce account to get configured by us. Following are the requirement of this client.

 

1. Since Student and Course are having a many to many relationship, the Junction object will have several fields representing the Student’s performance in those Courses. A Student will have the Status of PASS or FAIL and MARKS OBTAINED for each of its Course as well.

Click here to learn more

For this solution make a picklist having name Status and values PASS or FAIL and a number field named Marks Obtained in the junction object this will do the trick.

 

2. All the Professor will get an email 2 days before the Course completion asking the Professors to provide marks to those Students in its Course.

Click here to learn more

For this what i have done is first create a email field in in Professor and Course object and made the email field mandatory. Than I have created a trigger on Course to auto update the email field in the Course object with Professors email. I hope you have done part-1 and part-2 already and you have already created a trigger on course the best practices tells us that we should not make more than one trigger on a single object. So update this part also in your trigger and this part will auto update the email field in Course object with the email field in Professor.

 

Trigger:

Map<Id, Course__c> profCourseMap = new Map<Id, Course__c>();

List<Course__c> fullCourseList = [SELECT Id, Name, Professor_del__c, Professor_Email__c FROM

Course__c WHERE Id IN: Trigger.newMap.keySet()];

for (Course__c course : fullCourseList) {

if (Trigger.isInsert) {

profCourseMap.put(course.Professor_del__c, course);

}

if (Trigger.isUpdate && Trigger.oldMap.get(course.Id).Professor_del__c != course.Professor_del__c &&

course.Professor_del__c != NULL) {

profCourseMap.put(course.Professor_del__c, course);

}

}

System.debug(‘profCourseMap————–‘ + profCourseMap);

System.debug(‘profCourseMap————–‘ + profCourseMap);

List<Course__c> listToBeUpdated = new List<Course__c>();

List<Professor__c> mainProfList = [SELECT Name, Email__c

FROM Professor__c

WHERE Id IN: profCourseMap.keySet()];

for (Course__c course : profCourseMap.values()) {

for (Integer i = 0; i < mainProfList.size(); i++) {

if (course.Professor__c == mainProfList[i].Id) {

course.Professor_Email__c = mainProfList[i].Email__c;

listToBeUpdated.add(course);

}

}

}

System.debug(‘listToBeUpdated————‘ + listToBeUpdated);

update listToBeUpdated;

 

Workflow Rule:

Now that I have updated the field in now we will create a worflow rule to send the email to professor. For ths first go to setup find workflow rules in quick search box and click on work flow rule. Now click on the New rule button select Course object then click next button.

creating workflow rule1

Now fill in the required fields as shown below:

creating workflow rule21

 

 

 

We have created the logic for two days earlier than today because we needed the email to be send to Professor will send two days before the end date of the Course. Now save the rule after checking the syntax. Than it will show two related lists in Workflow actions.

Create a new Immediate Worklow action add workflow action is a picklist pick the email alert from it and fill in the required fields as shown below:

part2

Than click Save and after that click on Done button that’s it your work is done. You just need to activate the workflow rule from the page you are redirected to.

part3

Now your professor will get the email every time when his course is going to end.

 

 

3. A Student Approval process will determine the Student is passed or not. The Approval process will have University Dean(User) as the final approve.

Click here to learn more

For this it is already written that you have to create a approval process for it. Now I am going to create an approval process for you.

First go to setup type approval process in the quick find box than click on the approval process.

Now click on the picklist Manage Approval Process For (Your Object) for us it is Student. Now click on the picklist create new approval process ad select Jump Start Wizard.

part6

Than fill in the name it will automatically fill the unique name and check the Add the Approval History related list to all Student page layouts checkbox.

part7

Than you get a criteria section but you don’t need any criteria so leave it as it is. Now in select approver section click on the 

part4 Now click save and you are done with the approval process. Now it will show in your Student related list page and if did everything same it will lokk like this when you click on submit for approval button in the related list of Student record page:

part5

 

4. Make sure the code coverage is above 95% of salesforce org.

Author: AJ

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

× How can I help you?