• Shikha Raheja 3
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
When attempting to create my Apex trigger for this Trailhead development exercise, I receive an error. I don't understand how this is possible, because the records haven't been updated, and still aren't updating.
"Challenge not yet complete... here's what's wrong:
Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true."


Here's my code:
trigger AccountAddressTrigger on Account (before insert, before update) {

    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c = true) {
            a.ShippingPostalCode = a.BillingPostalCode;
        }   
    }

}


 
Hi All,

I get this error all the time when I try to create an 'ApexClass' from one apex class using metadata:
Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: This type of object is not available for this organization faultcode=sf:INVALID_TYPE faultactor=

The code is similar than create an 'ApexPage', although 'ApexPage' works.
So could you help me with this?

Code to create 'ApexClass':
public PageReference mCreateApexClass(){
  MetadataService.MetadataPort service = createService();    
     MetadataService.ApexClass lvApexClass = new MetadataService.ApexClass();
     lvApexClass.apiVersion = 29;
     lvApexClass.fullName = myApexClassName;
     lvApexClass.status = 'Active';
     
     lvApexClass.content = EncodingUtil.base64Encode(Blob.valueOf(myApexClassContentAsString));
     MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { lvApexClass });
     result = results[0];
     displayStatus();
     return null;
}

 

Thanks in advance.