-
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='[email protected]'; 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
CRP Analyst App on Salesforce AppExchange by GetOnCRM Solutions
We have successfully launched CRP (Cost, Revenue, Profit) analyst application on AppExchange. GetOnCRM Solutions is proud to announce that we have successfully launched the CRP…
Salesforce Integrations - Enterprise Portfolio Considerations
Why Salesforce Integration? What are the Benefits? We live in a world where even the smallest of organizations have multiple systems in their IT Footprint…
Introduction to Salesforce Maps
Introduction Salesforce maps is an add-on paid product of Salesforce. It is a geo-location intelligence app that helps the business to optimize sales process territory…
Popular Salesforce Videos
Can a Housewife Make Career in Salesforce?
Wondering if a Housewife can make a career in Salesforce Join this user group for Salesforce job & career info and learn all you need…
Introduction to SOQL in Salesforce
This video explains what is SOQL or Salesforce Object Query Language in Salesforce technology with examples from daily life for your better understanding .
Salesforce Security and Sharing Model Demystified
The Salesforce Sharing and Security Model has undergone numerous enhancements and offers many features to help you configure it to meet the privacy requirements your…
Popular Salesforce Infographics
How To Sell Better in 2020 | Tips From Salesforce Leaders
There are various things that you need to pay heed on while selling something. In 2020, where technology is ruling the world, and we are…
Leverage Nonprofit trends with Salesforce Nonprofit Cloud
Salesforce Nonprofit Cloud is a suite of tools designed to help nonprofits take advantage of the latest trends and technologies. With the Nonprofit Cloud, your…
6 Steps to Take When Searching For a CRM Platform
One CRM platform may have excellent event tracking, which means you can learn what a specific visitor does on your website, from which pages they…