-
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
Salesforce Data Mask | Secure your Sandbox with Impenetrable Security
Salesforce sandbox is where the developers spend most of their lifetime. With all the development and testing taking place here, Salesforce sandbox is always a…
SALES PATH: Your Company’s Sales Processes in Lightning Experience
Sales Path is a great feature that Salesforce is made available for Lightning Experience only. This tool is designed to guide your sales reps through…
What is Einstein GPT? World's First Generative AI for CRM
Introduction Meet Salesforce's Einstein GPT, a new addition to the ever-expanding array of chatbots with AI capabilities. The service stands out slightly from the competition…
Popular Salesforce Videos
Salesforce Summer 20 Dynamic Forms
Salesforce’s Summer ’20 Release Notes have now been published, we can now dive under the hood to see what the top features are! Historically, Summer…
Get Started with Salesforce Commerce Cloud Einstein Product Recommendations
Personalize the shopping experience for your customers with Commerce Cloud Einstein Product Recommendations. Drive conversions, enhance product visibility and increase revenue per visit with AI-driven…
Career in Salesforce in 2022
In this video, Shrey is talking about starting your career in Salesforce. Here are the different career choices you have or different profiles that are…
Popular Salesforce Infographics
How Salesforce Einstein Can Improve Sales?
Customer Relationship Management has provided businesses with seamless means, marketing strategies and activities to help improve sales. The thing about traditional CRM is that it…
7 Must Know Features on the New Salesforce AppExchange
The AppExchange is an online marketplace for Salesforce apps, components, and consulting services. If you're a Lightning Platform developer or consultant, the AppExchange is the…
Choosing the Right Salesforce Partner - Guide
Tips To Hire The Right Salesforce Partner for Growth & Success Salesforce is compact with some of the most exemplary features like no other CRM…