-
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
Here's How You Can Ease Operations for Your Non-Profit Organization: With a Salesforce Customer Portal
Salesforce's powerful customer portals give you the tools to keep your organization running efficiently and provide your members, donors, and customers with more self-service and…
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 –…
Discover Key Features of Salesforce Financial Service Cloud
In today’s fast-paced financial industry, providing seamless, personalized, and efficient client experiences is no longer optional—it’s essential. Organizations across banking, insurance, and wealth management are…
Popular Salesforce Videos
Installation & Configuration Process of Salesforce 9Calendar
This video demonstrates the installation, configuration, and working of our latest Salesforce app 9Calendar. Watch this video till the end to understand its functionalities. Adding…
Driving Sales Productivity and Motivations from Your Salesforce Data
Meet OneUp Sales, the revolutionary sales motivation platform built for modern sales teams. By leveraging data extracted from systems you already use, OneUp powers lively…
Welcome to an all-digital, work-from-anywhere world | Salesforce Customer 360 | Salesforce Anywhere
Welcome to an all-digital, work-from-anywhere world. With Salesforce Customer 360, Salesforce can connect your teams, delight your customers, and grow your business together. Take the…
Popular Salesforce Infographics
Salesforce Marketing Cloud Features, Benfits and Advantages
Elevate Your Strategy: Discover the 4 Power Moves with Salesforce Marketing Cloud 1. ????????? ????????? Laser-focused campaigns for maximum impact. 2. ????-?????? ???????? Real-time analytics…
What are Salesforce Lightning Web Components?
Lightning Web Components ( LWCs ) are User Interface (UI) framework and utilized for creating applications with desktop and mobile technologies. This framework acts as…
How Can You Become a Salesforce Admin?
Sometimes a piece of technology seems to be used at every company. Knowing how to use that technology can help a person’s career. It can…