-
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
Salesforce Data Integrity & How to Maintain it?
This blog on Salesforce data integrity features a brief intro to the contacts and accounts information inside the Salesforce and how do you establish a…
Top Salesforce Spring '22 Features (Part - 2)
Salesforce Spring '22 release features part 2 is here to elevate, enhance and run your business efficiently. Let's have a look at what these features…
Implement Salesforce In Your Business
Salesforce is an amazing platform with boundless potential outcomes. As a Salesforce implementation project manager, you will own the implementation process and guide the project…
Popular Salesforce Videos
Nested Lists in Apex | Salesforce Development Tutorial for Beginners
In this video, Shrey has explained in detail the process to create a Nested List in Apex. Watch the full video to understand. If you…
How To Use Salesforce Marketing Cloud Automation Studio
In this video, you will learn how to use Salesforce Marketing Cloud Automation Studio which will help in automating various processes. The following points will…
Creation Of An Object In Salesforce | Salesforce Custom Objects
In this video, you will learn how to create a custom object in Salesforce, along with verification of the custom object in Salesforce. The following…
Popular Salesforce Infographics
How Low-Code App Development Enables Business Agility in Times of Change | Salesforce
Businesses in today's fast-changing, the digital-first world must adapt to change and meet customer demands in innovative ways. They have to quickly digitize to make…
10 Common Salesforce Mistakes—and How to Avoid Them
Salesforce integration is challenging if you don’t know exactly what you’re getting into. It’s an enormously valuable project, but diving into it without proper understanding…
Salesforce App Development, Listing and Expert Services | Concretio
Boost your business efficiency, provide better customer experience, streamline I.T. expenditures by eliminating the need of complex integrations and coding. Concretio is a Salesforce Consulting…