-
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 Nonprofit Cloud Implementation Guide
If you are reading this, then you are probably considering using Salesforce for your nonprofit organization. While Salesforce offers a variety of tools that can…
Create Multiple Records Of Different Salesforce Objects
Here we have a demo what we achieve through the code. What you need is to follow the below steps. Also, I welcome you guys…
Unit Testing on Salesforce Lightning Platform | Quick Guide
Before we begin, we have to know about unit testing i.e. what is unit testing and why do we test the code? All that stuff…
Popular Salesforce Videos
Things You Must Know About Salesforce Desk.com
Salesforce Desk.com is an all-in-one customer support application which is completely cloud based and which gives you the ability to buy services on per agent…
Work.com Workplace Command Center Demo
Work.com provides you with essential solutions designed to help businesses reopen the workplace as quickly as possible while helping to keep employees, customers, partners, and…
Salesforce Platform Developer 1 Certification Training | Salesforce Training Video
This Salesforce Training Video will give an overview of Salesforce Certification Training by explaining what is Salesforce, Why we need Salesforce, Salesforce Career opportunities and…
Popular Salesforce Infographics
How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…
How Your Business Can Leverage The Power of Salesforce Community Cloud?
Community Cloud is a cloud-based platform that enables businesses (small, medium, big) to build exceptional and interactive CRM-powered portals, forums, and sites that are faster…
Best Salesforce1 SMS Mobile App - 360 SMS App
360 SMS App is a One-stop texting solution platform for almost all kinds of industries including Healthcare, Hospitality, Education, etc. It can be your saviour…