Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

So I have the following class:

public static void sendmail(String documenttitle)
{
    List<Id> contactids = new List<Id>();
    List<user> con = new List<User>();
    con = [select Id from User where name IN ('User A', 'User B', 'User C', 'User D')];
    for(User u : con)
    {
        contactids.add(u.Id);
    }  


ContentDocument cont = new ContentDocument();


if(documenttitle.contains('Media'))
{
    Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
    mail.setTargetObjectIds(contactids);
    mail.setTemplateId('00AA0000001AaaA');
    mail.saveAsActivity = false;
    Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
} 

}

Which sends out an email to four recipients (Users A-D) when apiece of content with the word "Media" in the title is uploaded.

Now, Is there a way to include things such as:

ContentVersion.Title();
ContentVersion.Description();
ContentVersion.ContentUrl();
ContentVersion.OWnerID();

etc...

into the body of the email through apex? I can't seem to find a way to access that info directly through the email template...

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

You should be able to do a SOQL query and a Visualforce email template.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.