-
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
What are External Objects in Salesforce? | The Ultimate Guide
Salesforce is a cloud-based customer relationship management (CRM) platform that allows businesses to manage their interactions with customers and prospects. Salesforce offers a variety of…
10 Warning Signs Your Salesforce Implementation Is Heading for Disaster
Salesforce is a powerful Customer Relationship Management (CRM) tool that helps businesses streamline operations, enhance customer interactions, and drive business growth. However, the journey from…
Best Practices for Data Security in Salesforce
When we deal with data security in Salesforce, we are essentially talking about securing our data from unauthorized access. There might be an environment with…
Popular Salesforce Videos
Deleting Contacts in Salesforce Marketing Cloud
Delete contacts to remove contact information from your Marketing Cloud Contact Builder account. Delete contact information to meet data compliance regulations. In this episode, Eliot…
Is Salesforce Career Recession Proof?
Is Salesforce Career Recession Proof? Watch this video and get all the knowledge about the Salesforce industry. Join this useful group for Salesforce job &…
Object Oriented Programming - Salesforce Developer Tutorial
In relation to programming languages, object-oriented means that the code focuses on describing objects. An object can be anything that has unique characteristics, such as…
Popular Salesforce Infographics
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…
How to Use Psychology to Target Your Buyer?
Ever wanted to get into the minds of your customers and figure out how they think? Ever wanted to know the best methods to convince…
Pardot January 2020 Release [Infographic]
HML Personalisation on Landing Pages and Forms What: HML is the new way to add personalization to Pardot marketing assets, replacing variable tags – you…