-
Salesforce Trigger is not working, anyone help me with this code
Create object : Condidate__c
Fields : (All Text fields)
First Name
Last Name
Email
Brokerage
Manage Brokerage
Condidate Status (Webinar - Attended , Webinar -Not Attended)
User Created ( checkbox)
On insert:- Create Account if Brokerage !=null
- Create another account if Manage Brokerage != null and set parentId = Brokerage account id (created in 1 point)
- Create new contact record and set accountId = Manage Brokerage account id (created in 2 point)
- create new field condidate__c(lookup) on contact and fill it with Condidate__c record id
- Create task record for contact record (created in point 3)
Task.WhoId = contactId
Task.WhatId = Condidate__c
Task.Subject = 'Portal Contact Setup';
On Update :
if Condidate__c Status = Webinar - Attended and User Created = false ,
Create Portal user for Condidate child contact created in 3 point.trigger CreateContactcase on Hire_Form__c (before insert,before update){ list<Contact> conlist=new list<Contact>(); list<case> caselist=new list<case>(); if(trigger.isinsert){ for(Hire_Form__c hire:trigger.new){ if(hire.Status__c=='In Progress'){ Contact con=new Contact(); con.FirstName='Hire'; con.LastName='Trigger'; con.Email='[email protected]'; con.Phone='123456'; conlist.add(con); //hire.Candidate__c=con.Id; } } insert conlist; system.debug('=====>'+conlist); for(Contact con1:conlist){ case cc=new case(); cc.ContactId=con1.Id; cc.Status='New'; cc.Origin='Phone'; //cc.Id=conlist[0].Id; caselist.add(cc); } insert caselist; system.debug('=====>'+caselist); } if(Trigger.isupdate){ for(Hire_Form__c hire:trigger.new){ for(case c:caselist){ if(hire.Status__c=='completed' && hire.Status__c !=trigger.oldmap.get(hire.Id).Status__c){ c.Status='closed'; } } update caselist; system.debug('====>'+caselist); } } }
Log In to reply.
Popular Salesforce Blogs

5 Things To Consider When Switching From Salesforce Classic To Lightning
Are you still, using Salesforce Classic? If yes, don't hold your breath for anything "new and exciting" to arrive anytime soon. The best method to…

How to Communicate Between Two Salesforce Lightning Component Using Attributes?
How to communicate between two Salesforce Lightning Components using attributes? Communication between the two Salesforce Lightning Components simply means the transfer of data from the…

Salesforce HelpRange Integration: A Detailed Overview
As we all know, security is the most important consideration in any organization. For example, if any person outside of the organization (Org) has access…
Popular Salesforce Videos
Is Trailhead enough to crack Salesforce Interview?
In this video, Shrey answered one of the most asked questions related to Salesforce Interview. Let's see how beautifully Shrey answered this Question. We hope…
Governor Limits in Salesforce | Video Tutorial
Watch this amazing video to learn all about Governor Limits in Salesforce and a description of Governor Limits in Salesforce. If you have any doubts…
What are the Objects in Salesforce?
What is the difference between Profile Vs Permission Set? Salesforce Interview Questions and Answers by CRS Info Solutions. Watch this video to learn more. Read…
Popular Salesforce Infographics

Salesforce for Sales Development Success
Customer Relationship Management tools like Salesforce help sales teams juggle the hundreds of leads, tasks, and activities they need to complete each day. Modern sales is often…

The 10.5 Commandments of Salesforce Users
This great piece of visual goodness presents the 10 commandments every Salesforce user needs to follow. Make sure every single one of these practices is…

4 Reasons To Offer An Exceptional Customer Service
When it comes to customer service, our friends at Salesforce have a few tips and tricks up their sleeve. We were thrilled to help them…