Arjun Gupta August 17 -Technical PD1 Batch

Discussion in 'Salesforce Certification' started by Arjun Gupta_1, Aug 17, 2019.

  1. David Hamilton_1

    Joined:
    Jul 31, 2019
    Messages:
    4
    Likes Received:
    0
    So expanding on our project. I had added a custom field "Bill_Month__c" This is a selectable field to match the billing dates. The idea behind this is two fold.

    1) Easily see all bills for an individual based on month.
    2) To keep a duplicate record from being crated for the same customer and month. In order to accomplish this I added an additional method to my Handler Class. This method is trigger Before an Insert or Update. In order to get it to work I created two variables and two IF statements. How can this be improved on?


    public static void checkDupRecord(List<Bill__c> BillRecords){

    for(Bill__c billRecord : billRecords){

    Bill__c[] dupRec = [Select Id From Bill__c Where Customer__c =: billRecord.Customer__c And Bill_Month__c =: billRecord.Bill_Month__c];
    // Sized Used so no error woudl be thrown in the event no record found for insert.
    If (dupRec.size() > 0){
    ID dupId = [Select Id From Bill__c Where Customer__c =: billRecord.Customer__c And Bill_Month__c =: billRecord.Bill_Month__c].Id;
    If (dupId != billRecord.id){
    billRecord.addError('This Bill Record for this Month has already been processed '+dupRec);
    }
    }
    }
    }
     
    #51
  2. Arjun Gupta_1

    Arjun Gupta_1 Customer
    Customer

    Joined:
    Jan 30, 2019
    Messages:
    99
    Likes Received:
    43
    Hey Soujanya, Whenever you check an assert, make sure you query again on the object to see what got stored latest
     
    #52
  3. Arjun Gupta_1

    Arjun Gupta_1 Customer
    Customer

    Joined:
    Jan 30, 2019
    Messages:
    99
    Likes Received:
    43
    Hey David, i would recommend you to once see the duplicate rules on objects in Salesforce config too
     
    #53
  4. SAVEGA IT Solutions

    Joined:
    Aug 14, 2019
    Messages:
    6
    Likes Received:
    1
    Hi Arjun,
    I have cleared PD1 certification 3days back. The reason for me to take up the course was to clear the certification and I cleared it. Thanks for the training, it helped me clear the certification.
    Just a quick follow up question
    1. To get started with the salesforce development as you mentioned lightning is imported and you mentioned about posting few links on those. I did not see them on the community can ping me those again.
    2. JavaScript is another thing to know. Can you tell me Node.JS training will help me?

    Thanks,
    Praveena
     
    #54
  5. Arjun Gupta_1

    Arjun Gupta_1 Customer
    Customer

    Joined:
    Jan 30, 2019
    Messages:
    99
    Likes Received:
    43
    Hey Praveena,, i am very happy you cleared your exam. Node.js will not help you. Please start learning ECMA 9 Modern Javascript and HTML / CSS for basics. However, my suggestion is to first get started in trailhead on whatever is there for LWC and AURA Lightning Development
     
    #55
    SAVEGA IT Solutions likes this.
  6. SAVEGA IT Solutions

    Joined:
    Aug 14, 2019
    Messages:
    6
    Likes Received:
    1
    Thanks Arjun for the reply. Will follow trailhead
     
    #56

Share This Page