-
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
Apex Test Class in Salesforce - Lear All About It
Introduction Apex testing framework enables you to write and execute tests for your apex classes and triggers on the lightning platform. Apex unit tests ensure…
Bar Charts in Salesforce | Visualforce Developer Guide
The bar chart is a linear data series chart accessible in Visualforce. The linear series chart is a chart plotted against a standard rectangular system.…
Popular Salesforce Videos
Salesforce JavaScript Developer 1 Certification Series
Hi Everyone, SFDC Panther has started the Salesforce JavaScript Certification series and this is the first session. What you will learn: Variables Data Types Operators…
TrailheaDX '18 Opening Keynote - Part 3: Connect Every Experience
Salesforce TrailheaDX ’18 Opening Keynote – Part 1: Create Connected Customer Experiences TrailheaDX ’18 Opening Keynote – Part 2: Salesforce Platform Salesforce TrailheaDX ’18 Opening…
How to Create Bulk Custom Fields in Salesforce using BOFC App | Salesforce | BOFC | AppExchange
Want to perform multiple operations? This quick video walks you through how to create mass custom fields of any type (Master Detail, Lookup, Formula, Primitive…
Popular Salesforce Infographics
Salesforce Buzz | An Infographic
While Salesforce has been coined as the World's #1 CRM, there has been a constant buzz around the stats and facts of it. Almost 58%…
VT-What? How Salesforce Gives Back To ItsRainingRaincoats
ItsRainingRaincoats Founder Dipa Swaminathan grew up in Bangalore hearing about the need to be ‘other-regarding’ often. In Singapore, she noticed a divide between the country’s…
Welcome to the Internet of Customers | Salesforce Infographic
You’ve heard this age-old adage a thousand times: “The customer is always right.” Today more than ever, the customer has countless technologies and practices in…