-
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 use Leaflet Map in Salesforce?
Leaflet Map: Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. The leaflet is designed with simplicity, performance, and usability in mind. Let's…
Unleashing Collective Intelligence: How Salesforce Communities Empower Ideas Management?
Organizations are realizing the immense value of collective intelligence in driving innovation and staying ahead of the competition. Collective intelligence refers to the collective knowledge,…
Master the Art of Customer Service with Case Management | Salesforce
What is the top priority for any business today? If you anticipated it as ‘Customer Experience’, you are probably right. Recent research found that nearly…
Popular Salesforce Videos
How to Use the Lightning Knowledge Migration Tool | Salesforce Tutorial
Use the Lightning Knowledge Migration Tool to move your Classic knowledge base into Lightning Knowledge. The Lightning Knowledge Migration Tool works differently depending on whether…
Salesforce Service Cloud: Upload Files During a Live Chat
Chatbots are incredible automation tools that can streamline a variety of business processes. Still, regardless of how much they can accomplish, there are situations where…
Copy to Clipboard Functionality in Salesforce - Lightning Component Projects Series Part 2
In this video, I'm creating a lightning component Project for functionality i.e Copy to Clipboard. Watch this video and learn. If you have any doubts…
Popular Salesforce Infographics
Customer Service Words and Acronyms
Savvy service reps know it is important to stay hip with the lingo. If it seems like customers and agents always keep you guessing with…
Why Do Business Move To Salesforce?
Salesforce Improves Customer Data Quality & Management – One of the core functions of all CRMs is data management about customers. Salesforce delivers in this…
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…