You need to sign in to do that
Don't have an account?

Invalid type: ReadResult error showing even after creating Apex class from Metadata WSDL file
Below is code of the Apex class -
Whenever I save this class I am getting the error "Invalid type: ReadResult". I generated the Metadata WSDL and then generated the Apex class from the "Generate from WSDL" button in Apex Class section in salesforce. But still when I make the metadata call I receive the above error. I even tried referring the ReadResult datatype by using the Apex class generated from WSDL with the dot operator before the name (ClassName.Readresult). But still the error persists. Any solutions ?
public class Test2 { public static void GetEntitlementProcess(){ ReadResult readResult = metadataConnection.readMetadata('EntitlementProcess','PRAS 01'); } }
Whenever I save this class I am getting the error "Invalid type: ReadResult". I generated the Metadata WSDL and then generated the Apex class from the "Generate from WSDL" button in Apex Class section in salesforce. But still when I make the metadata call I receive the above error. I even tried referring the ReadResult datatype by using the Apex class generated from WSDL with the dot operator before the name (ClassName.Readresult). But still the error persists. Any solutions ?
It is certainly ok to use this wrapper for commercial project but you will need to retain copyright header of author, check with legal team of your company if they have a issue with it, but I don't see a problem in it.
Still if you really want to do it you have to kind of reinvent the wheel and apply hacks that Andrew Fawcett applied while writing this wrapper.
Also, if possible can you point me to the WSDL, maybe I can generate the classes in my devorg and have a look.
Technically, it should have been
metadataConnection.ReadResult readResult = metadataConnection.readMetadata('EntitlementProcess','PRAS 01');
But since you have already tried this out, can't be sure of the other issue.
So, it should be something like :
soapSforceCom200604Metadata when you generate the Apex class from the downloaded Metadata file ?