-
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
Enable Skype for Salesforce | The Developer Guide
We all are very much familiar with Skype, here I am going to tell you about how skype can be used for Salesforce, coordinates Salesforce…
Why Having a Preference Center is Key to Your Email Marketing Strategy | Salesforce Marketing Cloud
As Marketing Technology consultant, DemandBlue interacts with many digital marketers. Our team audits the full range of digital marketing assets that organizations manage. Based on…
Top Salesforce Spring '23 Release Features
The wait is finally over. Salesforce Spring '23 release features are here and we cannot wait to discover the outstanding releases. As we know by…
Popular Salesforce Videos
What is Validation Rule in Salesforce? Explain in details
Validation Rule will check the data entered by user during insert or update the operation and as per that it will actually take the action.…
Run Report With Filters from UiPath Studio | Salesforce
New features on Salesforce Activities Extention Package from UiPath MarketPlace: https://connect.uipath.com/marketplace/components/salesforce-activities-extention-package (0:40) Use complex object in the Query and Timeout part of the Setting to…
Prepare for TrailheaDX: Everything Salesforce Admins Need to Know
TrailheaDX is a one-of-a-kind virtual experience that connects makers, builders, doers, and dreamers looking to improve their Salesforce skillset. This year’s event includes exciting new…
Popular Salesforce Infographics
How to Select A Cerified Salesforce Administrator?
Once you implement Salesforce, one of the most important ways to stay successful is to designate an incredible Salesforce Administrator. Easier said than done, right?…
The Ultimate Marketing Automation Glossary
Sometimes, it sounds like marketers are speaking another language—especially when using terms associated with specific tools and platforms. It gets even more complicated when certain…
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…