• Pablo Roldan
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
Hi All,

I know that it's possible to call apex methods through the API or maybe something like that with executeAnonymous().
However, I am not really sure about that, so my question is if it's possible to call apex methods and get the result through the API or another way out salesforce?
If it's possible could you tell me how?

Thanks in advance.
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.
Hi All,

I know that it's possible to call apex methods through the API or maybe something like that with executeAnonymous().
However, I am not really sure about that, so my question is if it's possible to call apex methods and get the result through the API or another way out salesforce?
If it's possible could you tell me how?

Thanks in advance.
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.