-
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
Salesforce Marketing Effectiveness Bundle - What It Means for You?
For many years, Salesforce has been providing a variety of solutions to help organizations become more efficient and reliable in their operations. Whether it's Salesforce…
Salesforce Chatbot: Streamlining Customer Service and Support
Introduction Salesforce Chatbot is an AI-powered conversational agent designed to interact with customers in a natural and human-like manner. It leverages advanced NLP algorithms and…
Best Practices for Salesforce Integration: Streamlining and Optimizing Your Workflow
Salesforce integration plays a crucial role in connecting your org with other systems, streamlining workflows, and enabling data-driven decision-making. To ensure successful integration, it’s essential…
Popular Salesforce Videos
Salesforce User Experience UX Designer Certification
The Salesforce User Experience (UX) c is designed for individuals who have at least 6 months in UX design and 3–6 months’ experience utilizing UX…
How To Become A Salesforce Administrator | Salesforce Administrator Training
What does Salesforce developer do? Salesforce developers lead the testing and implementation of software development efforts, including coding, configuration, maintenance, installation, testing, and debugging, as…
Salesforce Multi-factor Authentication/Two-factor Authentication End User Training Video
Watch this video to learn all about Salesforce Multi-factor Authentication/Two-factor Authentication. This is a training video. Watch and learn.
Popular Salesforce Infographics
Why Integrate Your Pardot Account with Salesforce?
Salesforce Sales Cloud is primarily a sales tool while Pardot is a marketing automation platform. Both are designed to increase sales and maximize efficiency for…
How Salesforce Improves User Experience Through Hyper-Personalization?
Personalized service has become an imperative part for any business to succeed in the cut-throat competitive market. 66% of people want companies to understand their…
Top Salesforce Acquisitions Of All Time and In 2020
Salesforce has been on a shopping spree over the last few years. We all read quite frequently about Salesforce acquisitions. They are quick enough to…