You need to sign in to do that
Don't have an account?
Documemt Class : Constructor not defined
Hi All,
I want to create functionality for uploading image or logo in salesforce.
I am facing an issue when I tried to create an object of standered object Document in Unlimited Edition with 28.0 version.
Below is code :
public with sharing class UploadLogoForProfiles
{
public Document document {
get {
if (document == null)
document = new Document();
// Error: Compile Error: Constructor not defined: [Document].<Constructor>() at line 6 column 20
return document;
}
set;
}
public PageReference upload()
{
document.AuthorId = UserInfo.getUserId();
document.FolderId = UserInfo.getUserId();
try
{
insert document;
}
catch (DMLException e)
{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error occured'));
return null;
}
finally
{
document.body = null;
document = new Document();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Success.'));
return null;
}
}
Please help me to resolve this issue.
Yes , I do have Document class already present
You can use Schema.Document to create a new Document, since you have a Document class.