I was over-joyed when I got the call from that company. I really like their company. That is a really young company. As a young company, they move rapidly, and things are truly always changing. As a workaholic that I am, that kind of environment is my favorite. I love working and I definitely miss working a lot. I am the type of person, even you are not going to pay over time, I would stay there and work late, during that time I reflect on what I could improve, even thinking through what my coworker did that I can learn from or how I can improve from their mistakes, etc. That’s what I did when I was working previously anyway. I am quite self-sufficient when it comes to learn something on my own. I love this company’s culture as well, they are fun at the same time everyone works extremely hard as well. “Work hard, play harder” type of model, well, that’s just what I feel their company is like.
Let’s get into it, shall we?
That interview was good. Here it is. The interview contained talking about your past experience, and two questions, one is SOQL related, the second one is a trigger.
First, SOQL Link to heading
So the question was “Write a method can return a group of the account ids from account which the opportunities and case are open”. Apparently this is a question related to controller type of questions, you need to think in that way, that works for me.
Now let’s take a look at this problem. “Write a method can return a group of the account ids from account which the opportunities and case are open”. It has been two days, so I probably didn’t remember the question word from word exactly, but I know this is pretty close compare to what they were asking me. Here are my thought process now: first off, they are asking for a “method”, so you need to incorporate that in the answer; second, read the question again, “Write a method can return a group of the account ids from account which the opportunities and case are open”, so there are couple things we can list out:
- It should return account id
- The conditions are: “opportunities and cases are open”, this is the question you can ask your interviewer, how to determine “open”. I went back and checked in my developer org, for Opportunity object, currently I only have the field “stage”, so I will be using that as the determination point of “Open”. Case has “Status” field, so I will be using that.
- The relationship between the 3 object should be: Account is the parent, with the children of Case and Opportunity:

Schema Builder for the relationships
Now let’s try to write the code:
// the method
public static List<sobject> getAccountId() {
list<opportunity> oppList = new list<opportunity>();
list<case> caseList = new list<case>();
list<account> accountList = new list<account>();
//let’s just assume the following exist
oppList = \[Select AccountId from Opportunity where StageName = ‘Open’\];
caseList = \[Select AccountId from Case where Status = ‘Open’\];
accountList = \[Select Id from Account where Id in: oppList AND Id in: caseList\];
return accountList;
}
Someone pointed out that I should use the criteria “is not closed” instead of “status/stage = open”, because each field has multiple values that do not mean closed. This is actually an excellent point, and this is also a great question to ask your interviewer during your interview. It not only shows that you understand the condition, but also you are including all conditions.
The reason I am using “open” here is mainly because when I was given the question during the interview, they also gave me the sample conditions like the following:
// conditions:
// Opp_status == 'Open'
// Case_status == 'Open'
That’s the reason why I only used ‘Open’ here. The question stated pretty clear here.
The above would be my answer. Please let me know if you found any errors.
Second, Trigger Link to heading
Trigger: imagine there are two objects, Parent__c and Child__c, when the checkbox on Parent__c (Parent_checkbox__c) is checked, it should automatically check all the checkboxes in Child__c(Child_checkbox__c)
Your first intension should always be ask yourself, “Can I solve this with workflow rules and process builder?” Because when you can solve with a click why bother using code.
When I write triggers, I have couple steps I follow to help me to finish a trigger easier. The following are the steps:
- Define if this is an update, insert? Before or after?
- Figure out the relationship between the objects, who is the parent and who is the child, how are you going to access the data
- Figure out the logic behind it
Now let’s follow my thinking process:
- In our case, the Parent checkbox has to be checked in order for the checkboxes on Child to be checked, so it will have to be “after” trigger. Therefore, it is “after insert, after update”
- The relationship is clear, parent is the parent, child is the child. So at least we will need two lists here
- If parent_checkbox__c == true, then find all children related to that parent, then check all child_checkbox__c
trigger Parent\_Checkbox\_trg on Parent\_\_c (after insert, after update) {
private list<Id> parentId = new list<Id>();
for(Parent\_\_c p:trigger.new){
if(p.parent\_checkbox\_\_c==true) parentId.add(p.Id);
}
//I am assuming that parentId is in the child object
//I asked the interviewer if we are only assuming the cases where we //only need to worry about check all checkboxes, and they told me to //start from there
private list<Child\_\_c> childrenList = new list<Child\_\_c>();
for(Child\_\_c c:\[select id from Child\_\_c where parentId in:parentId\]){
if(c.children\_checkbox\_\_c == false) {
c.children\_checkbox\_\_c = true;
childrenList.add(c);
}
}
if(!childrenList.isEmpty()) update(childrenList);
}
Above is my answer for this question, the following contained another condition when the parent checkbox is unchecked: (We didn’t cover this part during the interview, but the following is how I would do it)
trigger Parent\_Checkbox\_trg on Parent\_\_c (after insert, after update) {
private list<parent\_\_c> parentList = new list<parent\_\_c>();
for(Parent\_\_c p:trigger.new){
parentList.add(p);
}
//I am assuming that parentId is in the child object
//This is the case where the checkbox will be unchecked //automatically
private list<Child\_\_c> childrenList = new list<Child\_\_c>();
for(Child\_\_c c:
\[select id from Child\_\_c where parentId in:parentList\]){
if(parentList.parent\_checkbox\_\_c == true) {
if(c.children\_checkbox\_\_c == false) {
c.children\_checkbox\_\_c = true;
childrenList.add(c);
}
}
else if(parentList.parent\_checkbox\_\_c == false) {
if(c.children\_checkbox\_\_c == true) {
c.children\_checkbox\_\_c = false;
childrenList.add(c);
}
}
}
if(!childrenList.isEmpty()) update(childrenList);
}
Please let me know if you see any problems or have any suggestions, I would really appreciate it!
Key Points During an interview: Link to heading
- Calm down while doing an interview. Especially, problem solving kind.
- Be yourself during an interview. Your interviewer wants to know the REAL you, they are looking for a friend to work with.
- If you made a mistake, it’s OK. Explain what you are thinking and talk out loud of your thinking process as always. Your interviewer cannot read your mind, you need to communicate frequently and efficiently.
- Last but the most important, communication. NEVER stop talking while you are trying to solve a problem. Moment of silence doesn’t really help here, even though you need some time to think the problem through, make sure that you explain that as well.
I want to finish up this article with a line from the TV show Friends, remember that episode where Joey thought he is getting to be Al Pacino’s butt? But he didn’t get it? I can totally relate to that while I am looking for a job. Always remember, your big break will come, like how Phoebe puts it “No, I don’t think this was your shot. I mean, I don’t even think you just get one shot. I really believe big things are gonna happen for you, I do! You’ve gotta just keep thinking about the day that some kid is gonna run up to his friends and go ‘I got the part! I got the part! I’m gonna be Joey Tribbiani’s ass!’ ”. The journey of finding a job is hard, it always mixed with a tons of other feelings, but always remember that “You’ve gotta just keep thinking about the day that some kid is gonna run up to his friends and go ‘I got the part! I got the part! I’m gonna be Joey Tribbiani’s ass!’ ”. (This is the sixth episode of season one, “The one with the butt”)
Happy Job Hunting out there!
Always remember, “You will grow, it just takes time”.
P.S. Here is all the materials I used to prep for this interview.

Photo by Gelgas on Pexels.com