-
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

Strategies to Boost Nonprofit's Efficiency with Tableau CRM | Salesforce
With the Salesforce technology, known as Tableau CRM users can make data-driven decisions while saving a ton of time and money thanks to AI features…

DML Operations in Apex: All You Need to Know
In this Blog, we will study DML Operations in Apex. DML is used to insert, update, delete and undelete records. We can use upsert to…

5 Reasons Why You Should Say ‘YES’ to Salesforce Mobile App
If you’re in sales, you know how crucial the customer relationship management (CRM) platform is to move dealings through the pipeline. You may have been…
Popular Salesforce Videos
Winter 21 - Restrict Access to @AuraEnabled Apex Methods for Authenticated Users
Winter 21 - Restrict Access to @AuraEnabled Apex Methods for Authenticated Users The video explained the following Items: Action items to enable or disable the…
Salesforce Consultant or Salesforce Admin First? | Which is Better?
In this video, Kaelan Moss - Minute Admin briefs us on whether it's better to be a Salesforce admin or consultant first. Watch the video…
Marc Benioff: Slack Deal Makes Salesforce 'A Whole New Type of Company'
Salesforce, the CRM powerhouse that recently surpassed $20 billion in annual revenue, announced today it is wading deeper into enterprise social by acquiring Slack in…
Popular Salesforce Infographics

Choosing the Right Salesforce Partner - Guide
Tips To Hire The Right Salesforce Partner for Growth & Success Salesforce is compact with some of the most exemplary features like no other CRM…

Salesforce: Giving Buzz In Numbers
Salesforce has been coined as the world’s top CRM and there is always a constant buzz around it’s latest developments. So let’s check out what…

Salesforce Pro Suite: Streamlining CRM for Small Businesses
Salesforce Pro Suite is CRM (customer relationship management) software specifically designed for small businesses. It combines various tools for marketing, sales, customer service, and commerce…