-
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
What Does Salesforce Administrator Mean in 2023?
A Salesforce administrator is a professional who is responsible for managing and maintaining a Salesforce implementation. They are responsible for the configuration, customizations, and upkeep…
What Is The Need Of A Salesforce Consultant?
Choosing and implementing are two different things. Once you have decided that your organization will be using Salesforce as CRM platform, the immediate question that…
What is Salesforce CPQ and How Does it Work?
Salesforce CPQ is a software solution that helps businesses automate and streamline their sales processes by providing a way to quickly and accurately create quotes,…
Popular Salesforce Videos
AMPscript Lookup - Salesforce Marketing Cloud Functions in 5 minutes
Salesforce Marketing Cloud functions in 5 minutes! In this video, Cameron Robert shows how Lookup() works in Salesforce Marketing Cloud using some helpful visuals to…
Salesforce Admin Certification 2020 Questions Explained with References - Part II
How to prepare and pass Salesforce Admin Certification with Practice Exam Questions 2020 practice questions and answers for the Salesforce Administration Salesforce Certified Admin Exam Questions Salesforce Administrator Certification Exam…
Get the Most Out of Your Digital Adoption Efforts On Your Salesforce Community with GuideIn
Navigating online communities can be tricky. GuideIn is a Salesforce-native, lightning-ready product from the house of Grazitti that enables you to maximize digital adoption in…
Popular Salesforce Infographics
Why Salesforce End-user Training Matters for Smooth Implementation
This infographic 'Why Salesforce end-user training matters for smooth implementation' appeared first on Cynoteck. The progress of any CRM implementation depends on its general adoption…
See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…
The ROI of Building Apps on Salesforce
With our ROI Calculator, embark on a journey to discover how much more productive your organization can be when building apps using the Salesforce Platform.…