• SFDC demo
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Hi All,
I have created a parent-child relationship on two custom metadata in my case, My apex trigger is not covering because of custom metadata, but I couldn't access parent records to a child in a test class. Please help me with this.

here below my code.
         I am invoking the test data from test class to set custom metadata in triggerHander 
          //Main class if(test.isrunningtest()){
                list<DuplicateUpdateRules__mdt> duplicateUpdateRulesList=new list<DuplicateUpdateRules__mdt>();
                duplicateUpdateRulesList=DuplicateManagementHelperTestBulk.getDuplicateUpdateRu();//Get testdata to cover
                }
                
    Test class

 //set testData DuplicateKeys
    public DuplicateKeys__mdt getDuplicateKeys() { //Parent 
        DuplicateKeys__mdt objDuplicatekey=new DuplicateKeys__mdt();
        objDuplicatekey.DeveloperName ='AR_DupKey1_Seq1';
        objDuplicatekey.Country__c='AR';
        objDuplicatekey.FieldAPIName__c='DupMatchkey1__c';
        objDuplicatekey.ObjectAIPName__c='Account';
        objDuplicatekey.Id='m0j9E0000004Ck4QAE';
        return objDuplicatekey;
    }
//Child custom metadata.
     public  List<DuplicateUpdateRules__mdt> getDuplicateUpdateRu(){
      list<DuplicateKeys__mdt> objDuplicatekeylists = [SELECT id,DeveloperName, Country__c, FieldAPIName__c, ObjectAIPName__c FROM DuplicateKeys__mdt where DeveloperName ='AR_DupKey1_Seq1'];
system.debug('objDuplicatekeylists--->'+objDuplicatekeylists);
          /*List<DuplicateUpdateRules__mdt > duplicateRuleList = new List<DuplicateUpdateRules__mdt>();
           DuplicateUpdateRules__mdt dup1=new DuplicateUpdateRules__mdt(
                DeveloperName= 'ARTest1',
                FieldAPIName__c ='BillingStreet',
                DuplicateKeys__c=objDuplicatekeylists[0].id, 
                Sequence__c=1
            );

}            
                


 
how to attachment form web to lead form using web services API implementation.can u send sample code 
here, my requirments i am create a new lead form web to lead form, insert to attachments objects is it possiable ?
could you send me sample code using javascript or rest api