Duplicate Contact Trigger || Trigger Logic Building ||

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ต.ค. 2019
  • Want to learn more about salesforce join me at sfdcpanther.com Hi Everyone,
    In this video, we will discuss how to work with apex trigger and logic building.
    Below is the Agenda for the video
    1 - Problem Statement
    2 - Possible Solution
    3 - Choosing the right solution
    4 - Solution Approach
    5 - Develop the Apex Trigger
    6 - Assignment - Develop a Trigger to Prevent duplicate Lead Record based on FirstName, LastName, & Email
    Link to ApexTrigger:- gist.github.com/amitastreait/...
    Link to PPT:- www.slideshare.net/amitsingh6...
    Contact Me -
    LinkedIn
    / simplyamit
    FaceBook
    / sfdcpanther
    Twitter
    / cloudyamit
    Instagram
    t.me/sfdcpanther
    Blog
    sfdcpanther.com
    Email
    sfdcpanther@gmail.com
    Previous Video
    OAuth 2.0 • An Overview to OAuth 2...
    #SalesforceForBeginner #Salesforce #ApexTrigger
    #JourneyToSalesforce

ความคิดเห็น • 30

  • @D_Salesforce
    @D_Salesforce 7 หลายเดือนก่อน +1

    I have gone through many videos and sites but This is best solution to avoid duplicate records .

    • @sfdcpanther
      @sfdcpanther  6 หลายเดือนก่อน

      Thank You so much :)

  • @mchan9424
    @mchan9424 9 หลายเดือนก่อน

    This is the best solution i have seen so far for duplicate trigger scenario!

    • @sfdcpanther
      @sfdcpanther  8 หลายเดือนก่อน

      Thank You

  • @akashubhambhardwaj
    @akashubhambhardwaj 4 ปีที่แล้ว +2

    NICE ONE Amit Bhai

  • @jlayinronchi5888
    @jlayinronchi5888 4 ปีที่แล้ว +1

    Awesome😋

  • @vishwaskumarjyothula9286
    @vishwaskumarjyothula9286 3 ปีที่แล้ว

    Very good explanation amit

  • @abnn4053
    @abnn4053 3 ปีที่แล้ว

    Good explanation 🤗

  • @shivanandtotar4357
    @shivanandtotar4357 4 ปีที่แล้ว

    good explanation

  • @abhijeetgajbhiye
    @abhijeetgajbhiye ปีที่แล้ว

    Thank you

  • @JAYESHSHEWALE
    @JAYESHSHEWALE 4 ปีที่แล้ว +1

    Hi Amit,
    Thanks for sharing your knowledge.
    I wanted some help from your side regarding interview.
    Please tell me scenarios for trigger so that I can do the practice.
    Also please tell me how can I do the preparation for my interview.

  • @SalesforceMiind
    @SalesforceMiind 6 หลายเดือนก่อน

    Hi Amit, the above code is not working for before update scenario. please try to update any field of the existing contact. then it hits duplicate email found. The email of the contact record is getting assigned to both "newEmailSet" and "existingEmailSet".

  • @messilionel2000
    @messilionel2000 2 ปีที่แล้ว

    Can we use this trigger in lightning component

  • @rezanfunchica5839
    @rezanfunchica5839 3 ปีที่แล้ว +2

    I need give five possible triggers on this scenario

  • @shekarsangishetti5066
    @shekarsangishetti5066 2 ปีที่แล้ว

    trigger is not working for bulk records, when i tried to insert 10 records in that 1 record is duplicate, it should insert remaining 9 records but it is not happening can you help me on ths

    • @sfdcpanther
      @sfdcpanther  2 ปีที่แล้ว

      Trigger never insert the partial data. It will either fail or pass not other outcomes are there.
      If you want to insert the remaining records then first you have to insert all the records and then delete the duplicate records which is not recommended.

  • @priteshtiwari893
    @priteshtiwari893 4 ปีที่แล้ว +1

    I need your all videos on the salesforce from beggining so please provide me links

    • @sfdcpanther
      @sfdcpanther  4 ปีที่แล้ว

      Here is the link for you
      th-cam.com/users/SFDCPanther

  • @rucha520
    @rucha520 ปีที่แล้ว

    If you try to update any field on same record again it will throw error

  • @ironntech
    @ironntech 4 ปีที่แล้ว

    But how to update other fields of record it fires duplicate error

    • @sfdcpanther
      @sfdcpanther  4 ปีที่แล้ว

      Yeah. It will show duplicate error. There are 2 options that we can go to resolve the error.
      1 - In the trigger check if email field is changed then only execute the rest piece of code.
      2 - Do the data clean-up for that object that will resolve the issue as you will not be having the duplicate records for the object.

    • @proudindian6214
      @proudindian6214 2 ปีที่แล้ว

      @@sfdcpanther sir please tell the code to do that

  • @AmritMega
    @AmritMega 2 ปีที่แล้ว

    Hi Amit,
    While inserting duplicate records from Anonymous, on line no. 42, we are adding the first contact record email to the set and not calling addError on that record, but for second record, line no. 40 gets executed and we call addError method because we added that email while iterating the first record.
    Then, if we are not calling addError for the first record, then at least the first record should be inserted right, because for the second we called addError, and not the first.
    Please help me over this doubt.

    • @rucha520
      @rucha520 ปีที่แล้ว

      This may be due to bulkification befaire we are using List to insert records at once. So eaither all will be inserted or none. Since 1 record fails whole list is stopped from inserting.

  • @manalelkahili2787
    @manalelkahili2787 3 ปีที่แล้ว

    why we didnt work with newEmailSet

    • @sfdcpanther
      @sfdcpanther  3 ปีที่แล้ว

      NewEmailSet is only used to get the existing contact emails and once we got the existing email we don't need to use new emails

  • @sreenadhgudi3782
    @sreenadhgudi3782 2 ปีที่แล้ว

    Hai Amit Jii,
    I have a doubt, from all new version of records(being to insert, update and undelete)...we are adding email field into set (newEmailSet)...here itself we are filter the duplicate emails then why did we get error when we trying to add contacts with same email. I am not getting your point in your explanation, can you please clarify my doubt.

    • @sfdcpanther
      @sfdcpanther  2 ปีที่แล้ว +3

      Adding the emails in a set does not meant that you can prevent the duplicate records.
      Set contains unique values that means in a set no duplicate values will be added.
      Duplicate record is a complete different things

  • @hupendersharma5255
    @hupendersharma5255 3 ปีที่แล้ว

    sir agar aap list me duplicate record dolte ho to kam se kam 1 record to insert ho .. ye to puri list per error aa gaya
    Please insert record with anonymous window

    • @sfdcpanther
      @sfdcpanther  3 ปีที่แล้ว

      If you have duplicate records in a list and trying to update then you will get the error.
      What error are you getting?