-
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
Higher Education CRM: How Universities Use Salesforce for Admissions
The higher education sector faces mounting pressure to attract and retain students. According to the National Student Clearinghouse Research Center, undergraduate enrollment declined by 8%…
Salesforce Integration Mistakes to Avoid for Better Outcomes
Companies today rely on multiple work apps to manage diverse business functions. Right from HR, Finance, to Marketing & Sales, teams make use of various…
What is CPQ & How do Configure-Price-Quote Salesforce Solutions Bring in Revenue?
Creating sales is not a simple task. Building interest in a product demands additional attention, especially when crafting compelling product quotes. This often becomes a…
Popular Salesforce Videos
Prepopulate Field values in Salesforce Lightning Experience Using defaultFieldValues
Prepopulate Field values in Lightning Experience Using defaultFieldValues - Spring 20 This video demonstrates the following items: Set Record Type Id Using defaultFieldValues Enforce User…
4 Myths About Salesforce
Salesforce is a platform that helps businesses track the journey their customers take. It can help you effectively track and monitor your marketing and sales…
Introduction to Flow in Salesforce
This informative video on flows in Salesforce contains the following topics:- 00:00 - Introduction 02:14 - Agenda 02:49 - Flow is Automation 03:35 - The…
Popular Salesforce Infographics
Why Salesforce For Your Business?
Why Choose Salesforce? According to Salesforce, companies show the following trends as a result of Salesforce Implementation. 25% Increase in Revenue 35% Increase in Customer…
Selecting the Ideal Salesforce Managed Service Provider
Explore our engaging infographic, offering guidance on choosing the perfect Salesforce Managed Service Provider to maximize your Salesforce investment. Explore key factors to consider when…
The Salesforce Lightning Platform for Employee Engagement: Key Findings
Salesforce provides a system of engagement across the entire employee lifecycle that enables organizations to connect multiple back-end systems of record with one system of…