-
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

Maximizing Your Salesforce Platform ROI: 10 Proven Strategies
Introduction Salesforce is a seamless platform that can help businesses of all sizes streamline their sales, customer service, and marketing processes. However, simply investing in…

All About Apex Testing in Salesforce
Apex Unit Tests Apex unit tests ensure superior grades for your Apex code and let you meet the essentials for deploying Apex. Testing is the…

3 Winning Tactics to Use Social Media for Lead Generation
The success of an organization largely depends on its ability to generate quality leads that have a profound impact on customer acquisition, which in turn…
Popular Salesforce Videos
Transform the Consumer Experience - Salesforce Customer 360 Guide
The Transform the Consumer Experience Customer 360 Guide helps you: Unlock & unify data Personalize digital journeys Go direct to consumers Scale service across channels…
Salesforce is planning a blockchain product?
Salesforce is planning a blockchain product. That news alone would usually coincide with positive market moves, but in a diluted crypto market that isnt the…
How Big Was Salesforce Dreamforce 21 Park? Take a Walk.
This two-minute walk shows exactly how Salesforce Dreamforce 21 International Park was set up. See for yourself how big it is. Also, share your Dreamforce…
Popular Salesforce Infographics

Sales trends and performance: ANZ versus global
Technology is pushing customer expectations to all-time highs and sales organisations into uncharted territory. Organisations worldwide are coping differently as sales trends change operations. Sales…

Salesforce & Blockchain : Driving Businesses at the Speed of Trust
Knowing the disrupter and the thought leader mind, Marc Benioff always has a way of looking at things with a beginners mind. With this thinking…

5 Essential Skills for Salesforce Developers
Calling all aspiring Salesforce developers! Conquer the platform with these 5 must-have skills: ✅ Expertise ✅ Coding chops ✅ Problem-solving power ✅ Teamwork & communication…