-
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
How to manage Leads in Salesforce Sales Cloud? | Salesforce Sales Cloud
Salesforce Sales Cloud is a cloud-based application designed for different-sized enterprises to manage sales efficiently by collecting customer data and inputs of their interaction with…
A Complete Guide to Dreamforce 2024
Dreamforce, Salesforce’s flagship conference, is the highlight of the year for many professionals in the Salesforce ecosystem. With countless workshops, networking opportunities, and parties –…
Salesforce CPQ Certification: The Key to Unlocking Endless Career Opportunities!
Are you looking for a lucrative career in the field of Salesforce? Do you want to stand out among the crowd of applicants and earn…
Popular Salesforce Videos
Object Oriented Programming - Salesforce Developer Tutorial
In relation to programming languages, object-oriented means that the code focuses on describing objects. An object can be anything that has unique characteristics, such as…
Explore Our Salesforce Story
Explore the origins of Salesforce and how the Futureforce program came to be. Watch this video and do connect with us and share your experience…
Salesforce Trailhead 2020 - Developer Beginner - Search Solution Basics
This video explains: Explain when to create a customized search solution. Describe the difference between SOSL and SOQL. Identify which API protocols are available for…
Popular Salesforce Infographics
Explore The Salesforce Support Services Process Chart
This infographic helps you to explore the Salesforce Services process chart. Go through it and let me know in the comments in case of any…
How to Increase Employee Productivity Without Increasing Stress?
Are you looking for ways to increase employee productivity? Want to do it without cracking the whip and making everyone unhappy? Salesforce share their productivity…
Six Reasons Clients Love Salesforce Community Cloud
While there are way more than six reasons to love Salesforce Community Cloud, here are the top six reasons that keep coming up again and…