-
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
Different Clouds in Salesforce and Potential Future
Salesforce offers a range of cloud-based software solutions that are designed to help businesses of all sizes manage their customer relationships, sales and marketing efforts,…
How to Communicate Between Two Salesforce Lightning Component Using Attributes?
How to communicate between two Salesforce Lightning Components using attributes? Communication between the two Salesforce Lightning Components simply means the transfer of data from the…
Popular Salesforce Videos
Learn About Types of Sandboxes in Salesforce
A sandbox is a copy of your organization in a separate environment that you can use for a variety of purposes, such as testing and training.…
Mocking Apex Tests: Salesforce Tutorial
In this Video Leonardo Berardino talks about the following: Mocking Apex Tests and Apex Mock Examples Unit Tests x Integration Tests How to create unit…
Best Chrome Extensions for Salesforce
These are the best FREE Chrome Extensions to use with Salesforce. Installing Chrome extensions is the easiest way to enhance your experience on the Salesforce…
Popular Salesforce Infographics
Top 10 Salesforce Consulting Companies in India
Looking to hire a best Salesforce consulting company in India for your business? Here is a without-favour list of the top 10 Salesforce consulting companies…
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…
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…