-
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='hire@gmail.com'; 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
Everything You Need To Know About Salesforce Admin Certification Exam
Salesforce is a game-changer, ever-evolving, always innovating, #1 CRM platform globally. It is a huge company growing leap and bounds every year. It welcomes individuals…
Overcome Integration Mistakes With Salesforce Partners
In the age of API (application programming interface) and iPaaS (integration platform as a Service), enterprise data can easily be unified. Organizations are using the…
Popular Salesforce Videos
Top 50 Salesforce Lightning Interview Questions And Answers | Salesforce Lightning Interview
This video by MindMajix includes all the frequently asked Interview questions that give you an idea to crack your Salesforce Lightning interview smartly. These Interview…
Salesforce DMP – Capture, Unify and Activate Your Data
Learn how the Salesforce DMP allows marketers to capture, unify and activate their data enabling them to deliver more relevant and personalized experiences to their…
Salesforce Flow Best Practices: Salesforce Flow Design Patterns
Salesforce Flow Design Patterns from Fundamentals to Mastery. In this session, we will talk about the top 10 Salesforce Flow best practices. We will talk…
Popular Salesforce Infographics
How to Use Psychology to Target Your Buyer?
Ever wanted to get into the minds of your customers and figure out how they think? Ever wanted to know the best methods to convince…
Salesforce : Anatomy of a Productive Sales Rep
We are a nation obsessed with productivity. We look for ways to "hack" our way through life, squeezing the most out of every minute we…
What It Takes to Select the Ideal Salesforce Consulting Partner
Today there are thousands of companies that trust Salesforce CRM Services. Determining a strong Salesforce consulting partner for businesses seems like an easy process, but…